Forum Moderators: open
I have been asked to create a form listing around 30 options per form and need 10 forms, no problem. They however when an option is selected want it to generate a popup window instead of just going to the page. I can not seem to figure this one out after playing with it.
Here is my form code (ripped out all URLS and made gibberish)...
<form name="north">
<div align="center"><center><select NAME="reference" SIZE="1" onChange="goto_url(this)">
<option SELECTED>Northern Region</option>
<option VALUE="whatever/index.htm">North office</option>
<option VALUE="whatever2/index.htm">North office two</option>
<option VALUE="whatever3/index.htm">North office 3</option>
</select>
</center></div>
</form>
I tried using several popup windows scripts in combination with the value="" but it just goes to whatever/<a%20href=
I have no issues with forms, I have no issues with popup windows setup. Any suggestions on how to combine the two?
TIA,
Brian
Thank you for the quick response. I hate to say it but could you show me what you mean. I am afraid I do not understand how to go about that.
Brian
your onChange just calls the function
onChange="openPopup();"
function openPopup(){
popupurl="http://www.yourdomain.com/"+document.formname.formelement.options[document.formname.formelement.selectedIndex].value;
newwindow = window.open(popupurl, "windowname", "height=600,width=400,resizable=yes,scrollbars=yes");
newwindow.focus();
}
I just threw in some attributes for the new window, I didn't test this either but the premise is basically right
Brian
I seem to be getting an error on the JS...
"openPopup is not defined".
This is what I have...
<form name="north">
<div align="center"><center><select NAME="reference" SIZE="1" onChange="openPopup();"
function openPopup(){
popupurl="http://www.yourdomain.com/"+document.formname.formelement.options[document.formname.formelement.selectedIndex].value;
newwindow = window.open(popupurl, "windowname", "height=600,width=400,resizable=yes,scrollbars=yes");
newwindow.focus();
} >
<option SELECTED>Northern Region</option>
<option VALUE="none"></option>
<option VALUE="whatever/index.htm">Where</option>
<option VALUE="whatever/index.htm">Where 2</option>
</select>
</center></div>
</form>
Sorry to be soooo lost on this but I really want to make this work,
Brian