有如下JS代码,后面还有很多的,能不能给我搞个循环,只写一段就可以了?郁闷,不太懂JS//11
var test11 = document.getElementById("11");
var mysubmit = document.getElementById("submit");
test11.onclick = function()
{
this.readOnly = false;
this.className = "b";
mysubmit.style.display = "";
}
mysubmit.onclick = function()
{
test11.readOnly = true;
test11.className = "a";
this.style.display = "none";
}//12
var test12 = document.getElementById("12");
var mysubmit = document.getElementById("submit");
test12.onclick = function()
{
this.readOnly = false;
this.className = "b";
mysubmit.style.display = "";
}
mysubmit.onclick = function()
{
test12.readOnly = true;
test12.className = "a";
this.style.display = "none";
}//13
//12
var test13 = document.getElementById("13");
var mysubmit = document.getElementById("submit");
test13.onclick = function()
{
this.readOnly = false;
this.className = "b";
mysubmit.style.display = "";
}
mysubmit.onclick = function()
{
test13.readOnly = true;
test13.className = "a";
this.style.display = "none";
}