onclick="submitForm(document.selectname)"放到<FORM name="selectname" METHOD="POST">中
解决方案 »
- html中如何将选中的表格的一行显示在对应的文本框中
- 自动登录网站,急!
- jquery中的.append()出现复制
- extjs4.2.1 Ext.encode 抛出Uncaught RangeError: Maximum call stack size exceeded
- 用css+js做了个选项卡,选项卡中触发action后防刷新
- 谁有亿唐菜单的源代码啊?
- 关于document.write()的问题
- 怎么得到一个对象的当前在屏幕上的left和top?
- 如何在页面显示时将光标定位在一个指定的输入框中(无正文)
- js能否修改class中某个css属性 从而影响其他元素
- 给点参考吧!
- 一个类似csdn论坛的问题,不知道如果解决!
function submitForm() {
var a=document.selectname;
if (a.username.value== "") {
window.alert("用户名不能为空!");
return false;
} else {
frm.action = "keepon.jsp";
frm.submit();
return true;
}
}
</script><FORM name="selectname" METHOD="POST" onsubmit="return(submitForm())">
<tr>
<td>
<INPUT TYPE="text" NAME="username" SIZE="20" MAXLENGTH="20">
</td>
<td>
<input name="gonextpage" type="image" src="/images/gonextpage.gif" border="0" >
</td>
</tr>
</form>
<script language="javascript">
function submitForm(frm) {
if (frm.username.value == "") {
window.alert("用户名不能为空!");
return false
} else {
frm.action = "keepon.jsp";
return true
}
}
</script><FORM name="selectname" METHOD="POST" target="_blank" onsubmit="return submitForm(this)">
<table>
<tr>
<td>
<INPUT TYPE="text" NAME="username" SIZE="20" MAXLENGTH="20">
</td>
<td>
<input name="gonextpage" type="image" src="/images/gonextpage.gif" border="0">
</td>
</tr>
</form>
function submitForm() {
var a=document.selectname;
if (a.username.value== "") {
window.alert("用户名不能为空!");
return false;
} else {
frm.action = "keepon.jsp";
frm.submit();
return true;
}
}
</script><FORM name="selectname" METHOD="POST" onsubmit="return(submitForm())" onkeydown="if(event.keyCode==13)this.submit();">
<tr>
<td>
<INPUT TYPE="text" NAME="username" SIZE="20" MAXLENGTH="20">
</td>
<td>
<input name="gonextpage" type="image" src="/images/gonextpage.gif" border="0">
</td>
</tr>
</form>
就是要return false