View Full Version : submit to hyperlinks in a dropdown list

08-27-2007, 05: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>

<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">


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

Any ideas?

08-27-2007, 06:57 PM

08-27-2007, 07:47 PM

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>

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

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

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

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum