html 调用JavaScript函数,没有显示效果?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript">
function method1(){
var i=1;
var j=1;
for( i=1;i<=9;i++){
for( j=1;j<=i;j++){
document.write(i+"*"+j+'='+i*j+" ");
}
document.write('<br>');
}
}
function fun()
{
alert('你好!!');
}
function jianche(){ /* 此函数的调用出现问题 */
var str=form1.user.value;
if(str==""){
alert("请输入真实姓名!");
form1.user.foucs();
}
else{
var objExp=/[\u4E00-\u9FA5]{2,}/;
if(objExp.test(str)==ture){
alert("输入了正确的名字!");
}
else {
alert("输入的名字不正确!");
}
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>方法调用</title>
<style type="text/css">
<!--
.STYLE1 {font-size: xx-large}
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<p align="center" class="STYLE1">登录系统 </p>
<p align="center">用户名:
<input type="text" name="user" />
</p>
<p align="center">密码;
<input type="password" name="password" />
</p>
<div align="center">
<input type="submit" name="Submit" value="提交" />
<input type="reset" name="Submit2" value="重置" />
<input type="button" name="Submit3" onclick="method1()" value="检测" />
<input type="button" name="Submit4" onclick="fun()" value="好" />
<input type="button" name="Submit5" onclick="jianche()" value="很好" /> /*点击按钮“很好”时,没有反应*/
</div>
</form>
</body>
</html>
问题:点击按钮“很好”,没有反应? 求大神解答!谢谢!
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript">
function method1(){
var i=1;
var j=1;
for( i=1;i<=9;i++){
for( j=1;j<=i;j++){
document.write(i+"*"+j+'='+i*j+" ");
}
document.write('<br>');
}
}
function fun()
{
alert('你好!!');
}
function jianche(){ /* 此函数的调用出现问题 */
var str=form1.user.value;
if(str==""){
alert("请输入真实姓名!");
form1.user.foucs();
}
else{
var objExp=/[\u4E00-\u9FA5]{2,}/;
if(objExp.test(str)==ture){
alert("输入了正确的名字!");
}
else {
alert("输入的名字不正确!");
}
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>方法调用</title>
<style type="text/css">
<!--
.STYLE1 {font-size: xx-large}
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<p align="center" class="STYLE1">登录系统 </p>
<p align="center">用户名:
<input type="text" name="user" />
</p>
<p align="center">密码;
<input type="password" name="password" />
</p>
<div align="center">
<input type="submit" name="Submit" value="提交" />
<input type="reset" name="Submit2" value="重置" />
<input type="button" name="Submit3" onclick="method1()" value="检测" />
<input type="button" name="Submit4" onclick="fun()" value="好" />
<input type="button" name="Submit5" onclick="jianche()" value="很好" /> /*点击按钮“很好”时,没有反应*/
</div>
</form>
</body>
</html>
问题:点击按钮“很好”,没有反应? 求大神解答!谢谢!
...全文
相关推荐
javascript 显示当前系统时间代码
javascript 显示当前系统时间代码,脚本之家以前发布过类型的文章,大家可以多参考下。
在html中引入外部js文件,并调用带参函数的方法
下面小编就为大家带来一篇在html中引入外部js文件,并调用带参函数的方法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
犀利的JS,HTML网页效果大全
犀利的JS,HTML网页效果大全。。犀利的JS,HTML网页效果大全。。嫌太大的。。还有个小全。。
javascript点击按钮实现隐藏显示切换效果
主要介绍了javascript点击按钮实现隐藏显示切换效果,以一个完整的实例为大家分析了js点击按钮实现隐藏显示切换的功能,感兴趣的小伙伴们可以参考一下
JS显示隐藏DIV(动画效果)
封装好的JS显示隐藏DIV(动画效果,递增显示,递减隐藏),很实用很炫的效果,已测试支持ie,firefox,safari,opera,谷歌浏览器.有bug和不足处欢迎指正,交流.


