[問題] 請問這段想要動態產生表格的code有問題嗎?
var tr = document.createElement("tr");
var td1 = document.createElement("td");
var td2 = document.createElement("td");
var td3 = document.createElement("td");
var input1 = document.createElement("textarea");
var input2 = document.createElement("textarea");
var hint_id = document.createElement("input");
var spam = document.createElement("span");
var count = 0;
input1.setAttribute("name","hint[]");
input1.setAttribute("cols",17);
input1.setAttribute("rows",3);
input2.setAttribute("name","content[]");
input2.setAttribute("cols",58);
input2.setAttribute("rows",3);
hint_id.setAttribute("name","hint_id[]");
hint_id.setAttribute("id","hint_id[]");
hint_id.setAttribute("type","hidden");
try{
count = document.getElementsByName("hint_id[]").length;
}catch(e){
count = totalCount;
}
hint_id.setAttribute("value",document.getElementById("mrid").value+"_"+count);
spam.setAttribute("class","funcText");
spam.setAttribute("name","spamTag");
spam.setAttribute("id",count);
spam.setAttribute("onclick","spamClick(this,event)");
spam.innerHTML = "請點選";
td1.appendChild(input1);
td1.appendChild(hint_id);
td2.appendChild(input2);
td3.appendChild(spam);
tr.appendChild(td1);
tr.appendChild(td2);
tr.appendChild(td3);
document.getElementById("mrform_table").appendChild(tr);
totalCount++;
我是透過一個按鈕,按了之後call這個function
但是..firefox可以,ie8也可以,
但是ie7和kkman都不行...
但是我找不到哪一個是ie7不支援的...
先謝謝大家了
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 115.43.123.6
推
01/03 21:46, , 1F
01/03 21:46, 1F
推
01/03 22:00, , 2F
01/03 22:00, 2F
推
01/03 22:25, , 3F
01/03 22:25, 3F
推
01/03 22:28, , 4F
01/03 22:28, 4F
→
01/03 23:41, , 5F
01/03 23:41, 5F
→
01/03 23:42, , 6F
01/03 23:42, 6F
→
01/04 00:06, , 7F
01/04 00:06, 7F