点一次会有提醒,再点就能通过,如何做? 比如,,在文本区输入0之后, 点一个NEXT按钮, 会有ALERT提醒不能输入零,点击ok之后,不改变值,再点击NEXT按钮,就能通过了,如何做啊?! 谢谢!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <input type="text" value="0" id="chk0" /><input type="button" value="next" onclick="if (document.getElementById('chk0').value==0) {alert('输入值不能为0!');this.onclick='';return false;}" <html><head><script>var f=true;window.onload = (function(){ txt1.onkeydown=function(){ f=(f&&event.keyCode!=48); }; btn1.onclick=function(){ if(f) alert("correct"); else{ alert("fault"); f=true; } };});</script></head><body><input type=button id=btn1><input type=text id=txt1></body></html> 加个hidden进去,第一次给它赋值1,NEXT按钮每次点击事件都判断hidden的值。if(hidden.value=="1"){ //pass}else{//stop} <script language="javascript">var x=0function check(){if(document.getElementById("text").value==0 && x==0){alert("输入值不能为零!")x=x+1return false}else{return true;}}</script> jquery查找元素 JavaScript代码怎么实现? 如何把覆盖在弹出大图上的小图去掉 请教,我想咨询个效果,不知道怎么实现,关于时间的 java 在javascript中如何給文本框賦值? SOS,高分送高手!!!!!!!!!!!!!!!!! 大家看,间单问题,在线等待! JQ根据select option的值,让该option被选中. easyui的datebox控件如何只要年月不要日 这段代码在IE8出错和Firefox3.6正常问题(主流全浏览器测试问题) 请问这种JS的定义类的方法出错在哪里?
<input type="button" value="next" onclick="if (document.getElementById('chk0').value==0) {alert('输入值不能为0!');this.onclick='';return false;}"
<head>
<script>
var f=true;
window.onload = (function(){
txt1.onkeydown=function(){
f=(f&&event.keyCode!=48);
};
btn1.onclick=function(){
if(f)
alert("correct");
else{
alert("fault");
f=true;
}
};
});</script>
</head>
<body>
<input type=button id=btn1>
<input type=text id=txt1>
</body>
</html>
if(hidden.value=="1")
{
//pass
}
else{//stop}
var x=0
function check(){
if(document.getElementById("text").value==0 && x==0){
alert("输入值不能为零!")
x=x+1
return false
}
else
{
return true;
}}
</script>