如何单击一个button按钮后去执行一个函数,不好意思这个问题也问(:-> <input type=button name="ok" value="ok" onclick="ok();"> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <input .... onclick="javascript:ok()"> 用了<input type=button name="ok" value="ok" onclick="ok();"> 还是不得,在IE的状态栏中有" 网页上有错误的提示" 请各位帮帮呀!!!!! 用了<input type=button name="ok" value="ok" onclick="ok();"> 还是不得,在IE的状态栏中有" 网页上有错误的提示" 请各位帮帮呀!!!!! <input type=button name="ok" value="ok" onclick="ok()"> 还是不行我还是把所有代码贴到这吧附:我使用的是 pws 并以下的代码全在一个htm文件中<html><head><title>加入新成成员</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><script language="JavaScript"><!--function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();}MM_reloadPage(true);// --></script><script language=JavaScript><!-- function ok() { alert("不能用,为什么"); }// --></script> </head><body bgcolor="#FFFFFF" text="#000000"><div id="Layer1" style="position: absolute; width: 682; height: 582; z-index: 1; left: 33px; top: 26px"> <!--webbot BOT="GeneratedScript" PREVIEW=" " startspan --><script Language="JavaScript"><!--function FrontPage_Form1_Validator(theForm){ if (theForm.name.value.length < 1) { alert("姓名是必填选项,请输入您的姓名。注:姓名可以是中文字符。"); theForm.name.focus(); return (false); } if (theForm.pwd.value.length < 1) { alert("密码是必填选项,请输入您的密码。"); theForm.pwd.focus(); return(false); } if ((theForm.pwd.value != theForm.repwd.value)) { alert("您所输入的较验密码不正确,请重新输入您的密码!"); theForm.pwd.value=""; theForm.repwd.value=""; theForm.pwd.focus(); return(false); } var checkOK = "0123456789-"; var checkStr = theForm.tel.value; var allValid = true; var decPoints = 0; var allNum = ""; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } if (ch != ",") allNum += ch; } if (!allValid) { alert("在 tel 域中,只能输入 数字 个字符。"); theForm.tel.focus(); return (false); } var checkOK = "0123456789-,"; var checkStr = theForm.moveTel.value; var allValid = true; var decPoints = 0; var allNum = ""; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } if (ch != ",") allNum += ch; } if (!allValid) { alert("在 moveTel 域中,只能输入 数字 个字符。"); theForm.moveTel.focus(); return (false); } var checkOK = "0123456789-.,"; var checkStr = theForm.call.value; var allValid = true; var decPoints = 0; var allNum = ""; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } if (ch == ".") { allNum += "."; decPoints++; } else if (ch != ",") allNum += ch; } if (!allValid) { alert("在 call 域中,只能输入 数字 个字符。"); theForm.call.focus(); return (false); } if (decPoints > 1) { alert("请在 call 域中输入一个有效数字。"); theForm.call.focus(); return (false); } var checkOK = "0123456789-.,"; var checkStr = theForm.chuanzhen.value; var allValid = true; var decPoints = 0; var allNum = ""; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } if (ch == ".") { allNum += "."; decPoints++; } else if (ch != ",") allNum += ch; } if (!allValid) { alert("在 chuanzhen 域中,只能输入 数字 个字符。"); theForm.chuanzhen.focus(); return (false); } if (decPoints > 1) { alert("请在 chuanzhen 域中输入一个有效数字。"); theForm.chuanzhen.focus(); return (false); } if (theForm.YouPian.value == "") { alert("请在 YouPian 域中输入值。"); theForm.YouPian.focus(); return (false); } if (theForm.YouPian.value.length < 6) { alert("在 YouPian 域中,请至少输入 6 个字符。"); theForm.YouPian.focus(); return (false); } if (theForm.YouPian.value.length > 6) { alert("在 YouPian 域中,请最多输入 6 个字符。"); theForm.YouPian.focus(); return (false); } var checkOK = "0123456789-"; var checkStr = theForm.YouPian.value; var allValid = true; var decPoints = 0; var allNum = ""; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } allNum += ch; } if (!allValid) { alert("在 YouPian 域中,只能输入 数字 个字符。"); theForm.YouPian.focus(); return (false); } return (true);}//--></script><!--webbot BOT="GeneratedScript" endspan --><form name="FrontPage_Form1" method="post" action="" onsubmit="return FrontPage_Form1_Validator(this)"> <p>姓 名: <!--webbot bot="Validation" B-Value-Required="TRUE" I-Minimum-Length="1" --><input type="text" name="name" maxlength="20" size="20"> </p> <p>性 别: <select name="select" size="1"> <option selected value="1">男 <option value="0">女 </select> </p> <p>密 码: <input type="password" name="pwd" size="20" maxlength="10"> </p> <p>确认密码: <input type="password" name="repwd"> </p> <p>电 话: <!--webbot bot="Validation" S-Data-Type="Integer" S-Number-Separators="," --> <input type="text" name="tel" size="20"> </p> <p>手 机: <!--webbot bot="Validation" S-Data-Type="Integer" S-Number-Separators="," --> <input type="text" name="moveTel" size="20"> </p> <p>寻 呼 机: <!--webbot bot="Validation" S-Data-Type="Number" S-Number-Separators=",." --><input type="text" name="call" size="20"> </p> <p>传 真: <!--webbot bot="Validation" S-Data-Type="Number" S-Number-Separators=",." --> <input type="text" name="chuanzhen" size="20"> </p> <p>E_Mail : <input type="text" name="E_Mail" size="20"> </p> <p>主 页: <input type="text" name="HomePage" maxlength="40"> </p> <p>地 址: <input type="text" name="Address" maxlength="50"> </p> <p>邮 编: <!--webbot bot="Validation" S-Data-Type="Integer" S-Number-Separators="x" B-Value-Required="TRUE" I-Minimum-Length="6" I-Maximum-Length="6" --> <input type="text" name="YouPian" maxlength="6" size="20"> </p> <p><input type="submit" value="提交" name="sumit"><input type="reset" value="全部重写" name="reset"> <input type=button name="ok" value="ok" onclick="ok()"> </p> </form></div>//<input type=button value=提交 onclick=dosub()> //用button加onclick事件!</body></html>单击 OK 按钮后在 IE 状态栏下有 “网页中有错误”的提示。 为什么? 回复人: redstarstar(红星星) (2002-1-23 15:08:36) 得0分 、、<input type=button name="ok" value="ok" onclick="ok();"> 应为:<input type=button name="ok" value="ok" onClick="ok()"> 回复人: icystone(石冰) (2002-1-23 15:08:50) 得0分 <input .... onclick="javascript:ok()"> 这是错误的,这在链接中才会用到 还是出错了,用了 <input .... onClick="javascript::ok()"> 以后IE 状态栏下没有 “网页中有错误”的提示。但也没有任何反应…… 还是出错了,用了 <input .... onClick="javascript::ok()"> 以后IE 状态栏下没有 “网页中有错误”的提示。但也没有任何反应…… 绝对正确!把OK换成OK111,<input .... onClick="return ok111();"> 给分! 或者把name="ok"换一个名字也是一样的道理,怀疑是因为有name="ok"导致错误! 蛋疼 ssh框架的h4中方言读取不了 ssh框架整合问题 在使用Hibernate时出现的空指针异常,求助 请教一个关于文件上传的问题 tomcat服务器dbcp连接池配置问题 一个很菜的sql事务问题 jsp连接mysql问题,我要疯了,啊啊啊 html:hidden 的 value怎么动态赋值 谁有servlets 的教程啊,能不能给我一份,万分感激 ,在线等待。。。。。。 免费150M空间申请,支持ftp访问.申请成功马上开通 在写BBS程序 写数据库操作的BEAN时有一点疑惑 大家帮忙看看? 请问ccnd() ,怎样去掉缓存
在IE的状态栏中有" 网页上有错误的提示" 请各位帮帮呀!!!!!
在IE的状态栏中有" 网页上有错误的提示" 请各位帮帮呀!!!!!
我还是把所有代码贴到这吧
附:我使用的是 pws 并以下的代码全在一个htm文件中<html>
<head>
<title>加入新成成员</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
<script language=JavaScript>
<!--
function ok()
{
alert("不能用,为什么");
}
// -->
</script>
</head><body bgcolor="#FFFFFF" text="#000000">
<div id="Layer1" style="position: absolute; width: 682; height: 582; z-index: 1; left: 33px; top: 26px">
<!--webbot BOT="GeneratedScript" PREVIEW=" " startspan --><script Language="JavaScript"><!--
function FrontPage_Form1_Validator(theForm)
{
if (theForm.name.value.length < 1)
{
alert("姓名是必填选项,请输入您的姓名。注:姓名可以是中文字符。");
theForm.name.focus();
return (false);
}
if (theForm.pwd.value.length < 1)
{
alert("密码是必填选项,请输入您的密码。");
theForm.pwd.focus();
return(false);
}
if ((theForm.pwd.value != theForm.repwd.value))
{
alert("您所输入的较验密码不正确,请重新输入您的密码!");
theForm.pwd.value="";
theForm.repwd.value="";
theForm.pwd.focus();
return(false);
}
var checkOK = "0123456789-";
var checkStr = theForm.tel.value;
var allValid = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("在 tel 域中,只能输入 数字 个字符。");
theForm.tel.focus();
return (false);
} var checkOK = "0123456789-,";
var checkStr = theForm.moveTel.value;
var allValid = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("在 moveTel 域中,只能输入 数字 个字符。");
theForm.moveTel.focus();
return (false);
} var checkOK = "0123456789-.,";
var checkStr = theForm.call.value;
var allValid = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch == ".")
{
allNum += ".";
decPoints++;
}
else if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("在 call 域中,只能输入 数字 个字符。");
theForm.call.focus();
return (false);
} if (decPoints > 1)
{
alert("请在 call 域中输入一个有效数字。");
theForm.call.focus();
return (false);
} var checkOK = "0123456789-.,";
var checkStr = theForm.chuanzhen.value;
var allValid = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch == ".")
{
allNum += ".";
decPoints++;
}
else if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("在 chuanzhen 域中,只能输入 数字 个字符。");
theForm.chuanzhen.focus();
return (false);
} if (decPoints > 1)
{
alert("请在 chuanzhen 域中输入一个有效数字。");
theForm.chuanzhen.focus();
return (false);
} if (theForm.YouPian.value == "")
{
alert("请在 YouPian 域中输入值。");
theForm.YouPian.focus();
return (false);
} if (theForm.YouPian.value.length < 6)
{
alert("在 YouPian 域中,请至少输入 6 个字符。");
theForm.YouPian.focus();
return (false);
} if (theForm.YouPian.value.length > 6)
{
alert("在 YouPian 域中,请最多输入 6 个字符。");
theForm.YouPian.focus();
return (false);
} var checkOK = "0123456789-";
var checkStr = theForm.YouPian.value;
var allValid = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
allNum += ch;
}
if (!allValid)
{
alert("在 YouPian 域中,只能输入 数字 个字符。");
theForm.YouPian.focus();
return (false);
}
return (true);
}
//--></script><!--webbot BOT="GeneratedScript" endspan --><form name="FrontPage_Form1" method="post" action="" onsubmit="return FrontPage_Form1_Validator(this)">
<p>姓 名: <!--webbot bot="Validation"
B-Value-Required="TRUE" I-Minimum-Length="1" --><input type="text" name="name" maxlength="20" size="20">
</p>
<p>性 别: <select name="select" size="1">
<option selected value="1">男
<option value="0">女
</select>
</p>
<p>密 码:
<input type="password" name="pwd" size="20" maxlength="10">
</p>
<p>确认密码:
<input type="password" name="repwd">
</p>
<p>电 话: <!--webbot bot="Validation"
S-Data-Type="Integer" S-Number-Separators="," -->
<input type="text" name="tel" size="20">
</p>
<p>手 机: <!--webbot bot="Validation"
S-Data-Type="Integer" S-Number-Separators="," -->
<input type="text" name="moveTel" size="20">
</p>
<p>寻 呼 机: <!--webbot bot="Validation" S-Data-Type="Number"
S-Number-Separators=",." -->
<input type="text" name="call" size="20">
</p>
<p>传 真: <!--webbot bot="Validation"
S-Data-Type="Number" S-Number-Separators=",." -->
<input type="text" name="chuanzhen" size="20">
</p>
<p>E_Mail : <input type="text" name="E_Mail" size="20">
</p>
<p>主 页:
<input type="text" name="HomePage" maxlength="40">
</p>
<p>地 址:
<input type="text" name="Address" maxlength="50">
</p>
<p>邮 编: <!--webbot bot="Validation"
S-Data-Type="Integer" S-Number-Separators="x" B-Value-Required="TRUE"
I-Minimum-Length="6" I-Maximum-Length="6" -->
<input type="text" name="YouPian" maxlength="6" size="20">
</p>
<p><input type="submit" value="提交" name="sumit"><input type="reset" value="全部重写" name="reset">
<input type=button name="ok" value="ok" onclick="ok()">
</p>
</form>
</div>
//<input type=button value=提交 onclick=dosub()> //用button加onclick事件!
</body>
</html>
单击 OK 按钮后在 IE 状态栏下有 “网页中有错误”的提示。 为什么?
回复人: redstarstar(红星星) (2002-1-23 15:08:36) 得0分 、、
<input type=button name="ok" value="ok" onclick="ok();">
应为:<input type=button name="ok" value="ok" onClick="ok()"> 回复人: icystone(石冰) (2002-1-23 15:08:50) 得0分
<input .... onclick="javascript:ok()">
这是错误的,这在链接中才会用到