setAttribute设置的属性无效??
页面生成的radio不能选择,class的设置也无效(如有效,背景为红色),怎么回事?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>DataGrid</title>
<style>
.class1
{ background-color: #ff0000 }
</style>
<script language="JavaScript">
function init()
{
dg = document.getElementById("DataGrid");
var tableBody = dg.getElementsByTagName("tbody").item(0);
for(var i = 0; i < 10; i++)
{
var tr = document.createElement("tr");
var td = document.createElement("td");
var radio = document.createElement("input");
radio.setAttribute("type", "radio");
radio.setAttribute("name", "group1");
radio.setAttribute("class", "class1");
radio.setAttribute("value", i + "");
td.appendChild(radio);
tr.appendChild(td);
tableBody.appendChild(tr);
}
dg.appendChild(tableBody);
}
</script>
</head>
<body onload="init()">
<table border="1" width="100%" id="DataGrid">
</table>
</body>
</html>