这段代码有错?为啥老报错 点击按钮报20行语法错误。。郁闷啦<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script> function a(){
var a=1;
window.showModalDialog("a.html",null,"dialogHeight=200px;dialogWidth=200px");
alert(window.returnValue);
}
</script>
</head> <body>
<input type="button" value="按钮" onclick="a()"/>
</body>
</html>
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script> function a(){
var a=1;
window.showModalDialog("a.html",null,"dialogHeight=200px;dialogWidth=200px");
alert(window.returnValue);
}
</script>
</head> <body>
<input type="button" value="按钮" onclick="a()"/>
</body>
</html>
还有个a.html 页面
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script>
function a(b){
window.returnValue=b.value;
alert(window.returnValue);
window.close();
}
</script>
</head> <body>
<input type="button" value="按钮1" onclick=a(this)/>
<input type="button" value="按钮2" onclick=a(this)/>
<input type="button" value="按钮3" onclick=a(this)/>
<input type="button" value="按钮4" onclick=a(this)/>
<input type="button" value="按钮5" onclick=a(this)/>
</body>
</html>
有错 代码写的不规范 onclick后要引号script要加上type 就行了 嘿嘿
代码写的不规范 onclick后要引号script要加上type 就行了 嘿嘿