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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Include hyperlinks inside dopdown list 4

Status
Not open for further replies.
Try This:

<script language=&quot;javascript&quot;>

function openWindow(url)
{
window.open(url, 'windowname','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,resizable=yes,scrollbars=yes,top=0,left=0,height=600,width=800');
}
</script>

<SELECT name=&quot;selectboxname&quot; ONCHANGE=&quot;javascript:eek:penWindow(selectboxname.value);&quot; SIZE=&quot;1&quot;>

<OPTION value=&quot;none&quot; selected>- Select a Link -</OPTION>
<OPTION VALUE=&quot;<OPTION VALUE=&quot;
</SELECT>

Hope this helps,
Erik
 
An elegant solution, Boomerang

I would suggest using
Code:
selectboxame.options[selectboxname.selectedIndex].value
instead of
Code:
selectboxname.value
. I think Netscape tends to be a little less forgiving with the second method.

Cheers, Neil
 
I agree with Neil. Using the value attribute of selectboxes is problematic at best. The syntax he gave will work more reliably. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Great Neil,

You are right, my solution didn't work in Netscape, but your's does! Great to see to make better solutions with more people. I vote you for this too ;-)

Erik
 
Can this script by modified to show the new page within a frameset?

I believe that it can but I am brain dead as to the javascript change required?

Thanks,
Mark
 
Yes. Example code:

Code:
// function called like:
// <select onChange='handleSelect(this}'>
//
function handleSelect( object ) {
    var value = object.options[object.selectedIndex].value;
    var target = parent.frames[ 'myTargetFrame' ];
    target.location.href = value;
}

Hope this helps. Cheers, Neil :cool:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top