请大家看以下代码。
我在表单域中,只要输入小于2个字符,就读取不出来。超过2个及以上,就没有问题。
<%@page contentType="text/html; charset=GB2312" %>
<html>
<head>
<title>测试网页</title>
<script language="JavaScript">
<!--
function btn_ok_onclick(){
document.forms[0].action = window.location;
document.forms[0].target="_self";
document.forms[0].submit();
}
//-->
</script>
</head>
<body bgcolor="#ffffff" scroll="no">
<form target="_self" method="post" name="testForm">
<table border="0" width="100%" height="100%" cellpadding="1" cellspacing="1">
<tr><td class="td05">
<b style="color:#4586c6">表单域1:</b>
<input name="test1" size="20" maxlength="20" class="textbox" value="<%=request.getParameter("test1")%>">
<b style="color:#4586c6">表单域2:</b>
<input name="test2" size="20" maxlength="20" class="textbox" value="<%=request.getParameter("test2")%>">
<input type="button" name="ok" value="提交" onclick="btn_ok_onclick();">
</td></tr>
<tr><td class="td05" valign="top">
<table border="1" width="100%" height="100"><tr>
<td>用request读取的表单域1值:<BR/>
字符测试request.getParameter("test1"):<%=request.getParameter("test1")%><BR/>
</td>
<td>用request读取的表单域2值:<BR/>
字符测试request.getParameter("test2"):<%=request.getParameter("test2")%><BR/>
</td>
</tr></table>
</td></tr>
</table>
</form>
</body>
</html>
我在表单域中,只要输入小于2个字符,就读取不出来。超过2个及以上,就没有问题。
<%@page contentType="text/html; charset=GB2312" %>
<html>
<head>
<title>测试网页</title>
<script language="JavaScript">
<!--
function btn_ok_onclick(){
document.forms[0].action = window.location;
document.forms[0].target="_self";
document.forms[0].submit();
}
//-->
</script>
</head>
<body bgcolor="#ffffff" scroll="no">
<form target="_self" method="post" name="testForm">
<table border="0" width="100%" height="100%" cellpadding="1" cellspacing="1">
<tr><td class="td05">
<b style="color:#4586c6">表单域1:</b>
<input name="test1" size="20" maxlength="20" class="textbox" value="<%=request.getParameter("test1")%>">
<b style="color:#4586c6">表单域2:</b>
<input name="test2" size="20" maxlength="20" class="textbox" value="<%=request.getParameter("test2")%>">
<input type="button" name="ok" value="提交" onclick="btn_ok_onclick();">
</td></tr>
<tr><td class="td05" valign="top">
<table border="1" width="100%" height="100"><tr>
<td>用request读取的表单域1值:<BR/>
字符测试request.getParameter("test1"):<%=request.getParameter("test1")%><BR/>
</td>
<td>用request读取的表单域2值:<BR/>
字符测试request.getParameter("test2"):<%=request.getParameter("test2")%><BR/>
</td>
</tr></table>
</td></tr>
</table>
</form>
</body>
</html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货