您的位置:首页 > Web前端 > JavaScript

【JavaScript】for循环得出多个span的值

2011-11-13 15:13 381 查看
http://topic.csdn.net/t/20060826/20/4977972.html

<body>
<form   id="Form1"   action="">
<span   id   ="sp1">Label1</span><br>
<span   id   ="sp2">Label2</span><br>
<span   id   ="sp3">Label3</span><br>
<span   id   ="sp4">Label4</span><br>
<span   id   ="sp5">Label5</span><br>
</form>
<script>
spans   =   document.getElementById("Form1").getElementsByTagName("SPAN")
for(i=0;i<spans.length;i++)
alert(spans[i].innerHTML)
</script>
</body>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: