JavaScript Form Action?
by LearneyLearney - 3/5/10 8:55 PM
I want to use a javascript dropdown menu to navigate to various pages on my website.
However the one I've selected won't validate
(http://validator.w3.org)
because required attribute "ACTION" not specified.
Here is the script (commented out):
/*
<script type="text/javascript">
<!--
function changePage(theform) {
num= theform.URLSelect.selectedIndex;
if (num==0) { site = "/folder/index.html"; }
if (num==1) { site = "/folder/something1.html"; }
if (num==2) { site = "/folder/something2.html"; }
if (num==3) { site = "/folder/something3.html"; }
if (num==4) { site = "/folder/something4.html"; }
if (num==5) { site = "/index.html"; }
top.location.href=site;
}
//-->
</script>
*/
Here is the dropdown menu:
<form>
<select name="URLSelect" onchange="changePage(this.form)">
<option value="/folder/index.html" selected>Something Home
<option>Something 1
<option>Something 2
<option>Something 3
<option>Something 4
<option>Main Home Page
</select>
</form>
In this example, what should the form "action" be?
Thanks in advance for any helpful advise all you experts can give me.

Moderator
CNET Staff
Samsung Staff
Dell Staff