NooB question drop down box

B

Ben

I think this is a simple task but have never done any web scripting. I want
a drop down box with two options (for now), if they select Option 1 and
submit it should go to Url 1 if they select Option 2 and submit it should go
to Url 2. All within same window (no popo up).

Sorry if this is too fundamental but I'd rather ask an expert than spend
hours messing with it. The web-host does use Front Page extentions.

Thanks fo any help.

- Ben
 
D

Dan

Ben,

You need to add a bit of code and a form on your page to get this to work.
Here's an example from my intranet that you can modify for your own needs:

<form name="form1">
<select name="links" onchange="parent.main.location=this.options
[this.selectedIndex].value" size="1">
<option selected value="javascript:void(0)">Choose a site...</option>
<option value="www.yahoo.com">Yahoo!</option>
<option value="www.microsoft.com">Microsoft</option>
</select>
</form>

The user will be redirected to the new site (in the same window) when making
a choice.

Dan
Undocumented FP MVP
 
J

Jon Spivey

No
<form name="form1">
<select name="links"
onchange="if(this.options.selectedIndex>0)location.href=this.options[this.options.selectedIndex].value">
<option selected value="">Choose a site...</option>
<option value="http://www.yahoo.com">Yahoo!</option>
<option value="http://www.microsoft.com">Microsoft</option>
</select>
</form>

A few script changes and also when you direct to a page via javascript you
must add http:// in front of the address. Script does not recognise a link
like www.site.com

--
Cheers,
Jon
Microsoft MVP

Dan said:
Ben,

You need to add a bit of code and a form on your page to get this to work.
Here's an example from my intranet that you can modify for your own needs:

<form name="form1">
<select name="links" onchange="parent.main.location=this.options
[this.selectedIndex].value" size="1">
<option selected value="javascript:void(0)">Choose a site...</option>
<option value="www.yahoo.com">Yahoo!</option>
<option value="www.microsoft.com">Microsoft</option>
</select>
</form>

The user will be redirected to the new site (in the same window) when
making
a choice.

Dan
Undocumented FP MVP


Ben said:
I think this is a simple task but have never done any web scripting. I
want
a drop down box with two options (for now), if they select Option 1 and
submit it should go to Url 1 if they select Option 2 and submit it should
go
to Url 2. All within same window (no popo up).

Sorry if this is too fundamental but I'd rather ask an expert than spend
hours messing with it. The web-host does use Front Page extentions.

Thanks fo any help.

- Ben
 
S

Steve Easton

Also you need to change onchange to onclick or people who navigate with the keyboard will
never get past the first selection in the dropdown.


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed..................
...............................with a computer

Jon Spivey said:
No
<form name="form1">
<select name="links"
onchange="if(this.options.selectedIndex>0)location.href=this.options[this.options.selectedIn
dex].value">
<option selected value="">Choose a site...</option>
<option value="http://www.yahoo.com">Yahoo!</option>
<option value="http://www.microsoft.com">Microsoft</option>
</select>
</form>

A few script changes and also when you direct to a page via javascript you
must add http:// in front of the address. Script does not recognise a link
like www.site.com

--
Cheers,
Jon
Microsoft MVP

Dan said:
Ben,

You need to add a bit of code and a form on your page to get this to work.
Here's an example from my intranet that you can modify for your own needs:

<form name="form1">
<select name="links" onchange="parent.main.location=this.options
[this.selectedIndex].value" size="1">
<option selected value="javascript:void(0)">Choose a site...</option>
<option value="www.yahoo.com">Yahoo!</option>
<option value="www.microsoft.com">Microsoft</option>
</select>
</form>

The user will be redirected to the new site (in the same window) when
making
a choice.

Dan
Undocumented FP MVP


Ben said:
I think this is a simple task but have never done any web scripting. I
want
a drop down box with two options (for now), if they select Option 1 and
submit it should go to Url 1 if they select Option 2 and submit it should
go
to Url 2. All within same window (no popo up).

Sorry if this is too fundamental but I'd rather ask an expert than spend
hours messing with it. The web-host does use Front Page extentions.

Thanks fo any help.

- Ben
 
B

Ben

Works like a charm! Thanks to all who replied very much!

- Ben

Jon Spivey said:
No
<form name="form1">
<select name="links"
onchange="if(this.options.selectedIndex>0)location.href=this.options[this.options.selectedIndex].value">
<option selected value="">Choose a site...</option>
<option value="http://www.yahoo.com">Yahoo!</option>
<option value="http://www.microsoft.com">Microsoft</option>
</select>
</form>

A few script changes and also when you direct to a page via javascript you
must add http:// in front of the address. Script does not recognise a link
like www.site.com

--
Cheers,
Jon
Microsoft MVP

Dan said:
Ben,

You need to add a bit of code and a form on your page to get this to
work.
Here's an example from my intranet that you can modify for your own
needs:

<form name="form1">
<select name="links" onchange="parent.main.location=this.options
[this.selectedIndex].value" size="1">
<option selected value="javascript:void(0)">Choose a
site...</option>
<option value="www.yahoo.com">Yahoo!</option>
<option value="www.microsoft.com">Microsoft</option>
</select>
</form>

The user will be redirected to the new site (in the same window) when
making
a choice.

Dan
Undocumented FP MVP


Ben said:
I think this is a simple task but have never done any web scripting. I
want
a drop down box with two options (for now), if they select Option 1 and
submit it should go to Url 1 if they select Option 2 and submit it
should go
to Url 2. All within same window (no popo up).

Sorry if this is too fundamental but I'd rather ask an expert than spend
hours messing with it. The web-host does use Front Page extentions.

Thanks fo any help.

- Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top