请教各位先进一个问题,
getElementById 是不是不能使用变量?
var tid = string;
for( i = 0 ; i < 10 ; i++ ){
tid = "aa" + (i+1) ;
document.getElementById(tid).href = "data" + (i+1) + ".html";
// tid 变量无法传入?
} }
原本
document.getElementById("aa1").href = …
document.getElementById("aa2").href = …
document.getElementById("aa3").href = …
……
请帮帮忙,要怎么样使用变量,才能传入getElementById?
谢谢!