华恩JAVA班第56天

xiaoxiao2021-02-28  87

华恩JAVA班第56天

<!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>使用style改变样式</title> <style type="text/css"> li{  font-size: 15px;  color: #ffffff;  background-image: url(images/bg1.gif);  background-repeat: no-repeat;  text-align: center;  height: 33px;  width:104px;  line-height:38px;  float:left;  list-style:none;  } </style> </head>

<body> <ul> <li οnmοuseοver="this.style.backgroundImage='url(images/bg2.gif)'" οnmοuseοut="this.style.backgroundImage='url(images/bg1.gif)'">资讯动态</li> <li οnmοuseοver="this.style.backgroundImage='url(images/bg2.gif)'" οnmοuseοut="this.style.backgroundImage='url(images/bg1.gif)'">产品世界</li> <li οnmοuseοver="this.style.backgroundImage='url(images/bg2.gif)'" οnmοuseοut="this.style.backgroundImage='url(images/bg1.gif)'">市场营销</li> </ul>

</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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>使用style改变样式</title> <style type="text/css"> li{  font-size: 12px;  color: #ffffff;  background-image: url(images/bg1.gif);  background-repeat: no-repeat;  text-align: center;  height: 33px;  width:104px;  line-height:38px;  float:left;  list-style:none;  } </style> </head>

<body> <ul> <li>资讯动态</li> <li>产品世界</li> <li>市场营销</li> </ul> <script type="text/javascript"> var len=document.getElementsByTagName_r("li"); for(var i=0;i<len.length;i++){  len[i].οnmοuseοver=function(){   this.style.backgroundImage="url(images/bg2.gif)";   }  len[i].οnmοuseοut=function(){   this.style.backgroundImage="url(images/bg1.gif)";   }      }

</script> </body> </html>

更多信息可以参见同学富晓磊的博客:http://blog.sina.com.cn/u/1798827371

 

转载请注明原文地址: https://www.6miu.com/read-74335.html

最新回复(0)