网页不能正常运行
各位大虾:
晚上好!
小弟刚学习做网页,写了一个htm页在VS2008中调试成功,但单独用IE8打开时,只显示了标题,就运行不了下面的javascrpt脚本,查了好久,不知道是什么原因?代码如下:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD THTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>JavaScript DOMColor Properties</title>
</head>
<body>
<h3>The color properties</h3> // 只运行到这行就结束了
<script type="text/javascript">
<!--
document.write("<br>")
document.write("<h4>Background Color</h4>")
document.write(document.bgColor)
document.write("<br>")
document.write("<h4>Old Foreground Color</h4>")
document.write(document.fgColor)
document.write("<br>")
document.write("<h4>ActiveLink Color</h4>")
document.write(document.alinkColor)
document.write("<br>")
document.write("<h4>UnvisitedLink Color</h4>")
document.write(document.linkColor)
document.write("<br>")
document.write("<h4>Visited Link Color</h4>")
document.write(document.vlinkColor)
document.write("<br>")
alert("Changing color")
document.fgColor="red"
document.write("<h4>New Foreground Color</h4>")
document.write(document.fgColor)
document.write("<br>")
// -->
</script>
</body>
</html>