...

View Full Version : submit to hyperlinks in a dropdown list



cogman
08-27-2007, 06:23 PM
I am a JS beginner. I have a dropdown menu in Cognos Report Studio that contains values that are hyperlinks to other reports. I need the JS code to perform a submit on the "Go" button. Below is an example of the code so far:


<form name="SAMPLE">

<select style="font-size:12px;color:#006699;font-family:verdana;background-color:#ffffff;" name="menu">
<option value="http://Hyperlink1>Value 1</option>
<option value="http://Hyperlink2>Value 2</option>
<option value="http://cnn.com">CNN News</option>
</select>

<input style="font-size:12px;color:#ffffff;font-family:verdana;background-color:#006699;" type="button" onClick="window.open(document.SAMPLE.menu.options document.SAMPLE .menu.selectedIndex].value);" value="GO">

</form>


I probably need to clean up the onClick event with the correct JS.

Any ideas?

nikkiH
08-27-2007, 07:57 PM
onClick="window.open(this.form.menu.options[this.form.menu.selectedIndex].value);"

cogman
08-27-2007, 08:47 PM
Thanks.

I changed the code to read like this and it work too:

<form name="Sample">
<select name="menu"
OnChange="location.href= Sample.menu.options[selectedIndex].value">
<option selected>Please Select...
<option value="Hyper1">value 1</option>
<option value="Hyper2">value207</option>
</select>
</form>

Do you know how to open it up in a seperate window???

nikkiH
08-27-2007, 08:49 PM
Yes, use the window.open instead of location.href ;)

cogman
08-27-2007, 08:54 PM
Thanks again!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum