PDA

View Full Version : Drop Down Menu and New Window


8mycsh
11-08-2002, 11:12 PM
Ok here goes....I have looked at other posts that deal with this but I still can't get it to work.

I have a page with a drop down menu on the parent that has 9 items in it. 8 items open in the parent but the last item in the menu I want to open a pop up window. Now I also I have a link on the parent page to open a different pop up window.

Can someone help me with the coding for the drop down menu I have got the coding for the regular hyperlink.



Here is the coding I have so far:

Top of page
-------------------------------------------
function newWindow(url,target){
open(url,target,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=1,resizable=n o,width=690,height=400');}
-------------------------------------------

Regular Link
------------------------------------------
<a href="http://www.thissite.com/fillin.htm" target="fillin" onclick="newWindow(this.href,this.target);return false;">


Drop Down Menu
-----------------------------------------
<select onChange="location=options[selectedIndex].value;" style="font-family:'Arial';color:#8C96A2;background-color:#FFFFFF;font-size:10pt;">
<option value="#">Please Choose...</option>
<option value="home.htm">Home</option>
<option value="form.htm">Consent Form</option>
<option value="payment.htm">Payment</option>
<option value="counselling.htm">Counselling</option>
<option value="research.htm">Research</option>
<option value="seminars.htm">Seminars</option>
<option value="about.htm">About Us</option>
<option value="contact.htm">Contact Us</option>
<option value="links.htm">Links</option>
<option value="????????">Appointments</option>
</select>

Thanks in Advance.

kdj2
11-08-2002, 11:51 PM
onChange="location=options[selectedIndex].value;"

change to:


onChange="go(this.options[this.selectedIndex].value, this.selectedIndex)"

and then add following:


function go(goThere,num){
if (num == 10) { // last entry in the select element
newWindow(goThere,"newWin");
} else { // all other links:
window.location.href = goThere;
}


e.g. num == 10 checks to see if the selected option is entry number 11 (index number 10) and if so it will open in a new window. select elements has it's options numbered 0,1,2,3,4,5... which is reason why item number 11 (the 11th option) has index number 10.

That should do it...