Click to See Complete Forum and Search --> : drop down menu


kanneko
06-23-2003, 09:30 AM
I need a drop down menu for my site.
I used a java script I found on a site, but i need the links to open in an other frame. I tried with the tag <option value="" target=""> and with the base target too but it doesn't work. I think I have to change something in the 1st part of the script, but i'm not really expert.....Please help me ;_;
I put here the code, so you can check better
thank you! :D


<FORM name=cs_form_name_0 method=post>
<SCRIPT language=JavaScript>
function CSURLPopupShow(formName, popupName, target) {
var popup = document[formName].elements[popupName];
if (popup.options[popup.selectedIndex].value != "")
window.open(popup.options[popup.selectedIndex].value, target);
popup.selectedIndex = 0; }
</SCRIPT>

<SELECT class=input
style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana,Geneva,Arial"
onchange="CSURLPopupShow('cs_form_name_0', 'cs_popup_name_0', '_top');"
size=1 name=cs_popup_name_0>
<option selected value="home.htm">main</option>
<option value="about.htm">about</option>
<option value="personaggi.htm">personaggi</option>
<option value="fz.htm">FZ info</option>
<option value="origin.htm">origin.htm</option>
<option value="games.htm">games</option>

&nbsp;
</select>
</form>

Jona
06-23-2003, 10:46 AM
This code uses the window.open() method, which means that you'd have to modify the code to make it work for frames. Assuming your target frame is named, "myTargetFrame," replace the window.open() line with the following code:


parent.frames[target].location.href=popup.options[popup.options.selectedIndex].value;


Of course, this means that you caller (onChange) will have to look more like this (I changed it up to make it more dynamic, as well):


onChange="CSURLPopupShow(this.form, this.name, 'myTargetFrame');"


Jona

kanneko
06-23-2003, 12:09 PM
thank you very much! Now it works :D

Jona
06-23-2003, 12:11 PM
Welcome you are! :)

Jona