<head>
<title> </title>
<style type="text/css">
.li_out{
background-image:url(images/bg1.gif);
color:yellow
}
.li_over{
background-image:url(images/bg2.gif);
color:yellow
}
</style>
<!-- 2、鼠标移动到菜单上时,改变菜单的样式-->
<script>
function overStyle(sum)
{
var lis=document.getElementsByTagName("li");
lis[sum].className="li_over";
}
function outStyle(sum)
{
var lis=document.getElementsByTagName("li");
lis[sum].className="li_out"
}
</script>
<ol>
<li id="li" class="li_out" onmouseover="overStyle(0)" onmouseout="outStyle(0)">资讯动态</li>
<li id="li" class="li_out" onmouseover="overStyle(1)" onmouseout="outStyle(1)">产品世界</li>
<li id="li" class="li_out" onmouseover="overStyle(2)" onmouseout="outStyle(2)">市场营销</li>
</ol>
<!-- 3、制作随滚动条上下移动的广告特效: -->
<script>
</body>
</html>
这个是什么意思呢?
="overStyle(0)"
="overStyle(1)"
="overStyle(2)"
="outStyle(0)"
="outStyle(1)"
="outStyle(2)“
为甚么要用数字
------最佳解决方案--------------------------------------------------------
document.getElementsByTagName("li");获取到的是标签是<li>的数组,0表示第一个<li>、1表示第二个<li>、2表示第三个<li>