Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drop down box selection

Status
Not open for further replies.

solo7

Technical User
Mar 14, 2001
243
NO
I have a drop down combo box which offers different web sites to choose from. Once chosen a new window opens and the site is displayed. I want to have a new selection which offers a link to an internal web page and is displayed in the "main" frame of my index page.


<SELECT ONCHANGE=&quot;window.open(this.options[this.selectedIndex].value, 'newWindow')&quot; SIZE=&quot;1&quot; name=&quot;Selection_Box&quot;>
<OPTION>- Select a Link -</OPTION>
<OPTION VALUE=&quot; </SELECT>


TIA,
solo7
 
solo7,

I put this in a &quot;left&quot; frame and it seems to do what you
are looking for. Try it out:

Code:
<html><head><title>Test</title>
<script language=&quot;JavaScript&quot;>
function go(url){
if(url.indexOf(&quot;[URL unfurl="true"]www&quot;)[/URL] > -1 && url != &quot;&quot;) {
  var nwwin = window.open(url, 'newWindow'); }
else if(url != &quot;&quot;) {
  parent.main.location = url; }
}
</script></head><body>
<select onChange=&quot;go(this.value)&quot;>
<option value=&quot;&quot;>Sel One</option>
<option value=&quot;[URL unfurl="true"]http://www.google.com&quot;>Google</option>[/URL]
<option value=&quot;test.txt&quot;>Intranet</option>
</select>
</body></html>

Shout back if it's not quite right.


Great Javascript Resource:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top