JavaScript----链接的颜色为什么不是指定的

来源:百度知道 编辑:UC知道 时间:2024/05/15 09:48:59
下面这段代码运行时链接的颜色为不什么不是指定的
<html>
<head>
<SCRIPT language="JavaScript">
document.linkColor="black";
</SCRIPT>
</head>
<body text="#0000FF">
<a href="http://www.baidu.com">www.baidu.com</a>
<BR>
<SCRIPT language="JavaScript">
document.write("颜色"+document.linkColor);
document.write("颜色"+document.fgColor);
</SCRIPT>
</body>
</html>
我也觉得这代码是对的但是就是不是指定的黑色

楼上那个显示不出来,用我这个CSS样式

<style type="text/css">
A {color:#7C7C7C;}
A:link {color:#7C7C7C;}
a:hover {color: #FF0000;}
A:visited{}
A:active {color:#336699;}

</style>

<html>
<head>
<SCRIPT language="JavaScript">
document.style.linkColor="black";
</SCRIPT>
</head>
<body text="#0000FF">
<a href="http://www.baidu.com">www.baidu.com</a>
<BR>
<SCRIPT language="JavaScript">
document.write("颜色"+document.linkColor);
document.write("颜色"+document.fgColor);
</SCRIPT>
</body>
</html>

注意我改动的地方:document.style.linkColor="black";