原来帮一小朋友写的简单的应用,没有什么技术含量,只是做一学习过程的记录。
<!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=utf-8">
<title>Document</title>
<style>
</style>
<script>
window.onload = function (){
var lis = document.getElementById('uls').getElementsByTagName('li');
for (var i = 0; i < lis.length; i++) {
lis[i].onmouseover = function(){
this.style.backgroundColor = '#ffffcc';
}
lis[i].onmouseout = function(){
this.style.backgroundColor = '#fbfafa';
}
lis[i].style.backgroundColor = '#fbfafa';
}
}
</script>
</head>
<body>
<ul id="uls">
<li><a href="#">德克萨斯扑克德克萨斯扑克</a></li>
<li><a href="#">德克萨斯扑克德克萨斯扑克</a></li>
<li><a href="#">德克萨斯扑克德克萨斯扑克</a></li>
<li><a href="#">德克萨斯扑克德克萨斯扑克</a></li>
<li><a href="#">德克萨斯扑克德克萨斯扑克</a></li>
</ul>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Document</title>
<style>
</style>
<script>
window.onload = function (){
var lis = document.getElementById('uls').getElementsByTagName('li');
for (var i = 0; i < lis.length; i++) {
lis[i].onmouseover = function(){
this.style.backgroundColor = '#ffffcc';
}
lis[i].onmouseout = function(){
this.style.backgroundColor = '#fbfafa';
}
lis[i].style.backgroundColor = '#fbfafa';
}
}
</script>
</head>
<body>
<ul id="uls">
<li><a href="#">德克萨斯扑克德克萨斯扑克</a></li>
<li><a href="#">德克萨斯扑克德克萨斯扑克</a></li>
<li><a href="#">德克萨斯扑克德克萨斯扑克</a></li>
<li><a href="#">德克萨斯扑克德克萨斯扑克</a></li>
<li><a href="#">德克萨斯扑克德克萨斯扑克</a></li>
</ul>
</body>
</html>
本文转自豪情博客园博客,原文链接:http://www.cnblogs.com/jikey/archive/2009/12/08/1619328.html,如需转载请自行联系原作者