-
javascript question
Why won't the 3 links at the top of the page submit this form? Thanks in advance.
<%
session("action") = request("action")
response.write(session("action"))
%>
<script language = "jscript">
var SubmitTracker = "<%=session("action")%>";
</script>
<table width="43%" border="0" bgcolor="#FFFFFF"
cellpadding="0" cellspacing="0">
<tr>
<td width="33%">
<div align="center"><a href="JavaScript:handleForm(SubmitTracker,
1);">1</a></div>
</td>
<td width="34%">
<div align="center"><a href="JavaScript:handleForm(SubmitTracker,
2);">2</a></div>
</td>
<td width="33%">
<div align="center"><a href="JavaScript:handleForm(SubmitTracker,
3);">3</a></div>
</td>
</tr>
</table>
<script language = "jscript">
function handleForm(Loader, NextPage) {
window.alert(Loader)
window.alert(NextPage)
switch (NextPage) {
case 1 : document.Page1.action.value="1"
break;
case 2 : document.Page1.action.value="2"
break;
case 3 :
document.Page1.action.value="3"
break;
}//end switch NextPage
switch (Loader) {
case 1 : document.Page1.submit();
break;
case 2 : document.Page1.submit();
break;
case 3 : document.Page1.submit();
break;
} //end switch Loader
}
</script>
<form method="post" name="Page1" action="tester.asp">
<input type="hidden" name="action" value=<%=action%>>
<input type="submit" value="submit">
</form>
-
Re: javascript question
Your SubmitTracker is empty on the page first access so the switch (Loader) find no compatible case and do nothing, so first initiate your SubmitTracker variable or use the default : option in the switch ...