在元素id中能不能用数组?
对
<img id = temp1 >
<img id = temp2 >
<img id = temp3 >
...
<img id = tempn >
如何用数组来定义和处理呢?
谢谢大家!
------解决方案--------------------
id 是唯一的,name可以用数组
document.getElementById("")
document.getElementsByName("")
一个有s,一个没s
------解决方案--------------------
会报错,但可以应用数组.
<img id = temp >
<img id = temp >
<img id = temp >
var temp[]=document.getElementById["temp"];
temp[i]
------解决方案--------------------
学习
查询谷 - www.chaxungu.com
在元素id中能不能用数组?该如何处理
编辑:chaxungu时间:2022-10-02 23:18:07分类:web开发