为什么同一个函数,提交方式不同,返回的结果也不一样呢
这个是函数:
<script language="javascript">
function goto()
{
if(document.getElementById("go").value=="")
{
alert("跳转参数不能为空!");
form2.go.focus();
return false;
}
else
{
i=document.getElementById("go").value
if( i < 1)
{
//window.location="default.asp?curpage=1";
alert("数值小于当前页!");
document.getElementById("go").focus();
}
else if(i > <%=rs4.pagecount%>)
{
alert("数值大于当前页!");
document.getElementById("go").focus();
}
else
alert(i);
//parent.location="index.asp?curpage="+i
window.location="jfgl.asp?curpage="+i;
}
}
</script>
这个是提交的页面里的
<form name="form2" method="post" action="jfgl.asp" onsubmit="return goto()">
<%if curpage=1 then%>
首页
<%else%>
<a href="?curpage=1" class="page">首页</a>
<%end if%>
<%if curpage=1 then%>
上一页
<%else%>
<a href="?curpage=<%=curpage-1%>" class="page">上一页</a>
<%end if%>
<%if rs4.pagecount<curpage+1 then%>
下一页
<%else%>
<a href="?curpage=<%=curpage+1%>" class="page">下一页</a>
<%end if%>
<%if rs4.pagecount<curpage+1 then%>
尾页
<%else%>
<a href="?curpage=<%=rs4.pagecount%>" class="page">尾页</a>
<%end if%>
<%=curpage%>/<%=rs4.pagecount%>页 共<%=rs4.recordcount%>条
<input name="go" type="text" id="go" size="3">
<img src="images/go.gif" align="absmiddle" width="30" height="18" onClick="goto();">
</form>
当我点击 <img src="images/go.gif" align="absmiddle" width="30" height="18" onClick="goto();"> 这个图片,可以正常翻页
但是当我在<input name="go" type="text" id="go" size="3"> 输入数字 然后直接回车,就不能正常翻页
但是当直接回车的时候,函数也执行了,但是就不能翻页
大家帮忙给看看
着急啊!!!