码迷,mamicode.com
首页 > 其他好文 > 详细

index的用法

时间:2015-08-17 23:32:43      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:

示例1:window.onload=function(){
var oPf=document.getElementById(‘pingfen‘);
var aLi=oPf.getElementsByTagName(‘li‘);
var i=0;

for(i=0;i<aLi.length;i++){
aLi[i].index=i;
aLi[i].onmouseover=function(){
for(i=0;i<aLi.length;i++){
if(i<=this.index)
{
aLi[i].style.background="url(star.gif) no-repeat 0 -29px";
}
else
{
aLi[i].style.background="url(star.gif) no-repeat 0 0";
}
}
};

aLi[i].onmousedown=function ()
{
alert(‘提交成功:‘+(this.index+1)+‘分‘);
};
}
};

index的用法

标签:

原文地址:http://www.cnblogs.com/hyperz/p/4737993.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!