<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>alert</title>
<script type="text/javascript">
function rec(){
var mychar="I love JavaScript";
alert(mychar);
}
</script>
</head>
<body>
<input name="button" type="button" onClick="rec()" value="点击我,弹出对话框" />
</body>
</html>为什么不能弹出对话框?
因为你分号是中文的,还有左半边括号是中文的。。。改成英文的就好了
按shift键来回切换就好,
第八、九行分号改英文的,alert(mychar),左边括号也改成英文输入法下的括号,就好了