<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
<script language="javascript">
function check(){
if(document.test.aaa.value == ""){
window.alert("aaa不可以为空!");
return false;
}else if(document.test.bbb.value == ""){
window.alert("bbb不可以为空");
return false;
}
}
function check1(){
if(check()){
document.test.action.value == "www.sohu.com";
document.test.submit();
}else{
history.back(-1);
}
}
</script>
</head><body><form name="test" method="POST" action="--WEBBOT-SELF--">
<p><input type="text" name="aaa" size="20"></p>
<p><input type="text" name="bbb" size="20"></p>
<p><input type="submit" value="提交" name="B1" onclick="javascript:check();"><input type="reset" value="重置" name="B2"></p>
</form></body></html>----------------------------
我写了一个,但提示信息后还是会post到其它页,怎么能实现提示信息后还停留在表单这页呢?
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
<script language="javascript">
function check(){
if(document.test.aaa.value == ""){
window.alert("aaa不可以为空!");
return false;
}else if(document.test.bbb.value == ""){
window.alert("bbb不可以为空");
return false;
}
}
function check1(){
if(check()){
document.test.action.value == "www.sohu.com";
document.test.submit();
}else{
history.back(-1);
}
}
</script>
</head><body><form name="test" method="POST" action="--WEBBOT-SELF--">
<p><input type="text" name="aaa" size="20"></p>
<p><input type="text" name="bbb" size="20"></p>
<p><input type="submit" value="提交" name="B1" onclick="javascript:check();"><input type="reset" value="重置" name="B2"></p>
</form></body></html>----------------------------
我写了一个,但提示信息后还是会post到其它页,怎么能实现提示信息后还停留在表单这页呢?
解决方案 »
- 回车使表格新增一行,各位请先看一下我的jsp代码,和简单的新增行有所不同
- 关于字符串的比较问题
- 帮忙看下这个JS怎么写?
- [PopupWindow]Permission denied to get property HTMLDivElement.parentNode错误
- 为什么这段js没有输出???
- 帮忙看看这段脚本为何this对象是无效的?
- 求一个曾经的顶帖地址,最好能在教我下CSDN的搜索用法。
- 取ifeam的值 ie 上可以运行,firefox不行 ??!!
- 窗口控制问题,关于工具栏等
- 框架中的打印问题
- <script src=...后面能不能接受客户端脚本的变量,在线急求!!!
- 有什么办法判断用户点开的页面是点击连接文字打开的,而不是在地址栏目输入地址后点刷新或者"转到"打开的
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
<script language="javascript">
function check(){
if(document.test.aaa.value == ""){
alert("aaa不可以为空!");
document.test.aaa.focus();
}else if(document.test.bbb.value == ""){
alert("bbb不可以为空");
document.test.bbb.focus();
}
else
{
document.test.action.value == "www.sohu.com";
document.test.submit();
}
}
</script>
</head><body><form name="test" method="POST" action="--WEBBOT-SELF--">
<p><input type="text" name="aaa" size="20"></p>
<p><input type="text" name="bbb" size="20"></p>
<p><input type="submit" value="提交" name="B1" onclick="check();"><input type="reset" value="重置" name="B2"></p>
</form></body></html>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
<script language="javascript">
function check(){
if(document.test.aaa.value == ""){
alert("aaa不可以为空!");
document.test.aaa.focus();
return false;
}
else if(document.test.bbb.value == ""){
alert("bbb不可以为空");
document.test.bbb.focus();
return false;
}
return ture;
}
</script>
</head><body><form name="test" method="POST" action="--WEBBOT-SELF--" onsubmit=" return check();">
<p><input type="text" name="aaa" size="20"></p>
<p><input type="text" name="bbb" size="20"></p>
<p><input type="submit" value="提交" name="B1"><input type="reset" value="重置" name="B2"></p>
</form></body></html>