mtd
01-31-2005, 01:11 AM
I am trying to put together a script that will launch a popup window from a user's selection from a selct box (aka dropdown menu). Here is what I have so far:
<script type="text/javascript">
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=350,height=500,left = 100,top = 100');");
}
</script>
<form name="stores_storedepartments_seafood">
<select name="seafood_options" class="extra_info_1" onChange="popUp(this)">
<option selected>Choose an option....</option>
<option>- - - - - - - - - - - - - - - - - - - - - -</option>
<option value="http://www.msn.com/">Fillets</option>
<option value="http://www.yahoo.com/">Shrimp</option>
<option value="http://www.apple.com/">Seafood Hors D'euvres</option>
<option>- - - - - - - - - - - - - - - - - - - - - -</option>
</select>
</form>
This (obviously) is not working. I am not very learned in JavaScript, so it may be an obvious answer that I am just overlooking.
I also foresee these problems in the future with the current method of implementation:
- multiple slect boxes/forms on one page: will one instance of the code handle multiple forms?
- the <option>s with no value ("Choose an option...", "- - - - - -"): will it return an error? It should just do nothing...
I know I am probably asking a lot, but I am overwhelmed and don't know where to start. Thanks in advance!!!
<script type="text/javascript">
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=350,height=500,left = 100,top = 100');");
}
</script>
<form name="stores_storedepartments_seafood">
<select name="seafood_options" class="extra_info_1" onChange="popUp(this)">
<option selected>Choose an option....</option>
<option>- - - - - - - - - - - - - - - - - - - - - -</option>
<option value="http://www.msn.com/">Fillets</option>
<option value="http://www.yahoo.com/">Shrimp</option>
<option value="http://www.apple.com/">Seafood Hors D'euvres</option>
<option>- - - - - - - - - - - - - - - - - - - - - -</option>
</select>
</form>
This (obviously) is not working. I am not very learned in JavaScript, so it may be an obvious answer that I am just overlooking.
I also foresee these problems in the future with the current method of implementation:
- multiple slect boxes/forms on one page: will one instance of the code handle multiple forms?
- the <option>s with no value ("Choose an option...", "- - - - - -"): will it return an error? It should just do nothing...
I know I am probably asking a lot, but I am overwhelmed and don't know where to start. Thanks in advance!!!