在哪里写数据检查函数 才起作用???? onsubmit="return datacheck()"> // 放在这里比较好 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Q1:你把按钮放到了<form>之外,当然就失效了;把按钮放进去,用FORM的ONSUBMIT 或按钮的ONCLICK 都可以;Q2:2.asp应该没最小化,是焦点转移到父窗口挡住2.asp了吧;没有回传参数需要的话,用SHOWDIALOGMODAL 1、按钮在<form>内 不行啊 按钮用不着了<form name="1" method="post" action="2.asp" traget="_blank" onsubmit="return datacheck()"> </form> 第二个问题。。是不是你在window.open()//里面的参数设置了让窗口最小化?如果不是,那么就是你的浏览器保留了你的浏览习惯,新开的窗口总是最小化~如果是这种情况,你在把所有浏览器窗口全部关闭,关闭最后一个的时候保存的窗口状态就是下一次启动浏览器新窗口的启动状态了~~我猜是这样~ 这是 我的<script language="javascript">function datacheck() { if (document.input1.sxhh.value==0 && document.input1.sxhh.value =="") { alert("手写货号不能为空"); document.input1.sxhh.focus(); return ; }}</script>在表单内<input type=submit onclick="datacheck()"> 虽然会弹出"手写货号不能为空"的对话框 但是 程序还会执行下去 没起作用?? he_8134 第一 我的<form name="1" method="post" action="2.asp" traget="_blank" onsubmit="return datacheck()"> </form> 中已经有onsubmit 其他事件 第二:二楼的toury 说得没错 2.asp 是没最小化 只是被1.asp给挡住了??有没有什么办法是2.asp 始终获得焦点???? <script language="javascript"> function datacheck() { if(document.input1.sxhh.value==0&&document.input1.sxhh.value==""){ alert("手写货号不能为空"); document.input1.sxhh.focus(); return false; } return true;} </script> <input type=submit onclick="return datacheck()" /> he_8134 还是不行啊 弹出alert("手写货号不能为空"); 信息后 还是会接着弹出2.asp 窗口 java2000_net window.opener.focus(); 我的意思是使2.asp 在1.asp上面 而不是相反的 楼主肯定在别的地方有错~~你试试下面的代码~~<form action="http://baidu.com"><input type="text" id="txt" /><input type="submit" onclick="return check()" value="提交"/></form><script>function check(){ var txt=document.getElementById("txt").value; if(txt==""){ alert("不能为空");return false; } return true;}</script> 这样还是不行的 alert 确定后 还是会执行 2.asp 因为有target="_blank" 加了target="_blank"也可以<form action="http://baidu.com" target="_blank"><input type="text" id="txt" /><input type="submit" onclick="return check()" value="提交"/></form><script>function check(){ var txt=document.getElementById("txt").value; if(txt==""){ alert("不能为空");return false; } return true;}</script> 但是<script>function check(){ var txt=document.getElementById("txt").value; if(txt==""){ alert("不能为空");return false; } return true;}</script> 在txt 的后面还有很多的数据项需要检查阿!!我就改为function check(){ var txt=document.getElementById("txt").value; if(txt==""){ alert("不能为空");return false; } return true;var txt=document.getElementById("txt").value; if(txt==""){ alert("不能为空");return false; } return true;var txt=document.getElementById("txt").value; if(txt==""){ alert("不能为空");return false; } return true;}</script>怎么不行呢? <script> function check(){ if(document.getElementById("txt").value==""){ alert("txt不能为空");return false; } else if (document.getElementById("txt1").value==""){ alert("txt1不能为空");return false; } else if (document.getElementById("txt2").value==""){ alert("txt2不能为空");return false; } else if (document.getElementById("txt3").value==""){ alert("txt3不能为空");return false; } //如果还有继续重复 else if //.....} </script> 在txt 的后面还有很多的数据项需要检查阿!!我就改为function check(){ var txt=document.getElementById("txt").value; if(txt==""){ alert("不能为空");return false; } return true; var txt=document.getElementById("txt").value; if(txt==""){ alert("不能为空");return false; } return true; var txt=document.getElementById("txt").value; if(txt==""){ alert("不能为空");return false; } return true; 在检查下一项之前你用了return,当然就不行了,呵呵 这个JQuery语句怎么写? 关于使用javascript取被选中部分html代码问题 表格问题?急,在线等 二级联动菜单出不来了 关于闭包的一段代码,不太理解,请指教 这个Javascript出错在哪里? 请问怎样在页面打开时将光标定位在文本框<INPUT TYPE=TEXT>,怎样在文本框按回车提交? 请教javascript中 input 的焦点的位置的问题! 急!!! outerHTML什么情况下会失效?javascript转换成vbscript?? 请问如何用javascript实现判断上传文件大小 如何添加换行 怎样实现类似www.dpreview.com上左边的特效菜单?
Q2:2.asp应该没最小化,是焦点转移到父窗口挡住2.asp了吧;没有回传参数需要的话,用SHOWDIALOGMODAL
<form name="1" method="post" action="2.asp" traget="_blank" onsubmit="return datacheck()">
</form>
第二个问题。。是不是你在window.open()//里面的参数设置了让窗口最小化?
如果不是,那么就是你的浏览器保留了你的浏览习惯,新开的窗口总是最小化~如果是这种情况,你在把所有浏览器窗口全部关闭,关闭最后一个的时候保存的窗口状态就是下一次启动浏览器新窗口的启动状态了~~我猜是这样~
function datacheck() {
if (document.input1.sxhh.value==0 && document.input1.sxhh.value =="") {
alert("手写货号不能为空");
document.input1.sxhh.focus();
return ;
}
}
</script>
在表单内<input type=submit onclick="datacheck()"> 虽然会弹出"手写货号不能为空"的对话框 但是 程序还会执行下去 没起作用??
第一 我的<form name="1" method="post" action="2.asp" traget="_blank" onsubmit="return datacheck()">
</form> 中已经有onsubmit 其他事件
第二:
二楼的toury 说得没错 2.asp 是没最小化 只是被1.asp给挡住了??
有没有什么办法是2.asp 始终获得焦点????
<script language="javascript">
function datacheck() {
if(document.input1.sxhh.value==0&&document.input1.sxhh.value==""){
alert("手写货号不能为空");
document.input1.sxhh.focus();
return false;
}
return true;
}
</script> <input type=submit onclick="return datacheck()" />
我的意思是使2.asp 在1.asp上面 而不是相反的
<input type="text" id="txt" />
<input type="submit" onclick="return check()" value="提交"/>
</form>
<script>
function check(){
var txt=document.getElementById("txt").value;
if(txt==""){
alert("不能为空");return false;
}
return true;
}
</script>
<form action="http://baidu.com" target="_blank">
<input type="text" id="txt" />
<input type="submit" onclick="return check()" value="提交"/>
</form>
<script>
function check(){
var txt=document.getElementById("txt").value;
if(txt==""){
alert("不能为空");return false;
}
return true;
}
</script>
function check(){
var txt=document.getElementById("txt").value;
if(txt==""){
alert("不能为空");return false;
}
return true;
}
</script>
在txt 的后面还有很多的数据项需要检查阿!!我就改为function check(){
var txt=document.getElementById("txt").value;
if(txt==""){
alert("不能为空");return false;
}
return true;
var txt=document.getElementById("txt").value;
if(txt==""){
alert("不能为空");return false;
}
return true;var txt=document.getElementById("txt").value;
if(txt==""){
alert("不能为空");return false;
}
return true;}
</script>
怎么不行呢?
<script>
function check(){
if(document.getElementById("txt").value==""){
alert("txt不能为空");return false;
}
else if (document.getElementById("txt1").value==""){
alert("txt1不能为空");return false;
}
else if (document.getElementById("txt2").value==""){
alert("txt2不能为空");return false;
}
else if (document.getElementById("txt3").value==""){
alert("txt3不能为空");return false;
}
//如果还有继续重复 else if
//.....
}
</script>
var txt=document.getElementById("txt").value;
if(txt==""){
alert("不能为空");return false;
}
return true;
var txt=document.getElementById("txt").value;
if(txt==""){
alert("不能为空");return false;
}
return true; var txt=document.getElementById("txt").value;
if(txt==""){
alert("不能为空");return false;
}
return true; 在检查下一项之前你用了return,当然就不行了,呵呵