<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>document.write</title>
<script type="text/javascript">
var mystr="我是";
var mychar="JavaScript";
document.write(mystr+"<br>");
document.write(mychar+"<br>");
document.write(mystr+mychar+"的忠实粉丝"+"<br>");
var box=mystr+mychar+"的忠实粉丝";
function box1(){
document.write(box);
}
/*function box2(){
if (box=="我是JavaScript的忠实粉丝") {
document.write("你真是太棒了!");
}
else{
document.write("再试试吧少年!");
}
}*/
</script>
</head>
<body>
<form>
<input type="button" value="点击我" onclick=" box1()">
<!--
<input type="button" value="再测试下" onclick=" box2()">
-->
<p><h1>加上注释掉的代码就有错,求指导!<h1>
</form>
</body>
</html>