简单的代码却不知道错在哪里。。。
<!DOCTYPE html>
<html>
<script>
window.onload=function ()
{
var biaoji=document.getElementsByName('biaoji').innerHTML;
var span=document.getElementsByTagName('span');
var i;
for(i=0;i<biaoji.length;i++)
{
biaoji[i].index=i;
if(biaoji[i]=="1")
{
span[this.index].innerHTML="Hello World";
}
}
}
</script>
<body>
<div name="biaoji">1</div>
<div name="biaoji">1</div>
<div name="biaoji">1</div>
<span>我爱你</span>
<span>我爱你1</span>
<span>我爱你2</span>
</body>
</html>