各位大虾:
晚上好!
小弟刚学习做网页,写了一个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>
晚上好!
小弟刚学习做网页,写了一个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>
<?xml version="1.0" encoding="UTF-8" ?>另外,注意文件的编码
我已删掉了:
<?xml version="1.0" encoding="UTF-8" ?> 这一句,
打开后,不行。
然后又删掉了:
xml:lang="en" lang="en" 这一句,
再重新打开,还是不行。
请各位高手帮忙。是不是IE8设置问题。
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>
<!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" xml:lang="en" lang="en">
<head>
<title>Mouse Overs</title>
</head>
<body>
<h3 onmouseover="this.style.fontSize='24pt'" onmouseout="this.style.fontSize='14pt'">Mouse Overs</h3>
<p>When it comes to rollovers, Netscape browsers are a little weak. The second image rollover works in Netscape 3.0+.
Gecko promises to be better.</p>
<a href="" onmouseover="m_over()" onmouseout="m_out()"><img alt="face" src="face.gif" border="0" /></a>
<script>
<!--
function m_over() {
document.images[0].src="face2.gif";
}
function m_out() {
document.images[0].src="face.gif";
}
// -->
</script>
</body>
</html>可以正常显示两个gif. IE8编码是简体中文,自动选择也试了。