日期:2014-05-16 浏览次数:20458 次
<input type="text" onsubmit="test(this)"/>
<script>
function test(o){
if(o.value==""){alert("请先输入");return false;}
else return true;
}
</script>
------解决方案--------------------
这是问题?
------解决方案--------------------
<input type="text" id="aaa" onsubmit="test"/>
<input type="submit"
<script>
function test(){
var a = document.getElementById("test").value;
if(a ==""){alert("请先输入");return false;}
else return true;
}
</script>
------解决方案--------------------
好像你们都忽略了个回车提交...至少触发事件的时候也看看keyCode等于13不撒!!
------解决方案--------------------
<form onsubmit="test">
<input type="text" id="aaa"/>
<input type="submit" />
</form>
<script>
function test(){
var a = document.getElementById("test").value;
if(a ==""){alert("请先输入");return false;}
else return true;
}
</script>
------解决方案--------------------
悲催了.........
------解决方案--------------------
<table border="0">
<tr>
<td>产品编码:</td>
<td><input type="text" id="code" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="查询" onclick="search()" />
</td>
</tr>
</table>
<script type="text/javascript">
function search(){
if(document.getElementById("code").value=="")
{
alert("请先输入!");
document.getElementById("code").focus;
return false;
}
}
</script>
------解决方案--------------------
=_=
------解决方案--------------------
我现在想的是楼主什么时候结贴给我分
------解决方案--------------------
这年代赚分真不容易。。。
<form onsubmit="test">
<input type="text" id="aaa"/>
<input type="submit" />
</form>
<script>
function test(){
var a = document.getElementById("test").value;
if(a ==""){alert("请先输入");return false;}
else return true;
}
</script>