这里我想让鼠标悬停在链接文本上,因为我已经应用了属性x.style.fontsize =" 40px&#34 ;;但是无法这样做。我想弄清楚这有什么问题,我该怎么办??????????
<script>
function big(x){
x.style.color = "red";
x.style.fontsize = "40px";
}
function small(x){
x.style.color = "white";
x.style.fontsize =20px;}
</script>
<meta http-equiv="content-Type" content="text/html; charset=utf-8" />
<link rel= "stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
</head>
<body>
<img src="tree.jpg" width="1340px"style="position:absolute;top:0px;height:655px">
<img src="logo.gif" height="200" width="180px"style="position:absolute;top:265px;left:600px">
<div="logo1" style="position:fixed">
<div id="logo" style="width:1340px;height:125px;background-color:BLACK;opacity:0.7"></div>
<img src="logo3.gif" alt ="vstudy" "height="150px" width="130px" style="position:absolute;left:0px;top:8px">
<p>
<span class ="home" style ="position:absolute;left:150px;top:50px;font-weight:bolder;color:white;font-size:18px">Where things go cyberneted...</span>
<span><a href="#" style="text-decoration:none;position:absolute;right:568px;top:50px;font-weight:bold;color:white;font-size:15px" onmouseover="big(this)" onmouseout="small(this)">HOME</a></span>
<span><a href="#" style="text-decoration:none;position:absolute;right:440px;top:50px;font-weight:bold;color:white;font-size:15px" onmouseover="big(this)" onmouseout="small(this)">OUR MISSION</a></span>
<span><a href="#" style="text-decoration:none;position:absolute;right:240px;top:50px;font-weight:bold;color:white;font-size:15px" onmouseover="big(this)" onmouseout="small(this)">PRODUCTS & SERVICES</a></span>
<span><a href="#" style="text-decoration:none;position:absolute;right:140px;top:50px;font-weight:bold;color:white;font-size:15px" onmouseover="big(this)" onmouseout="small(this)">ABOUT US</a></span>
<span><a href="#" style="text-decoration:none;position:absolute;right:20px;top:50px;font-weight:bold;color:white;font-size:15px" onmouseover="big(this)" onmouseout="small(this)">CONTACT US</a></span>
</p>
</div>
</html>
答案 0 :(得分:1)
你不需要JS。你可以使用CSS:
a{
font-size:20px;
}
a:hover{
font-size:40px;
}
使用JS编辑非单字CSS规则时,需要使用camelCase:
x.style.fontSize:40px;
注意资本S
答案 1 :(得分:0)
试试这个:
x.style.fontSize = "20px";
有大写字母 - fontSize
脚本标记为
<script type="text/javascript">