표 만 들 기

1720 단어 JavaScripthtmlBlogJ#
 

 
<title> </title>
<script language="javascript">
function createTable(){
var div=document.getElementById("a");
var _table=document.createElement("table");
_table.setAttribute("border","1");
_table.setAttribute("borderColor","black");
_table.setAttribute("width","200");
for(var i=0;i<10;i++)
{
var _tr=_table.insertRow(i);
for(var j=0;j<10;j++)
{
var _td=_tr.insertCell(j);
var _tn=document.createTextNode(i.toString()+j.toString());
_td.appendChild(_tn);
}
}
var _btn=document.createElement("input");
_btn.type="button";
_btn.value="delete";
_btn.onclick=function()
{
div.removeChild(_table);
div.removeChild(_btn);
}
div.appendChild(_btn);
div.appendChild(_table);
}
</script>
</head>

<body>
<input type="button" onClick="createTable()" value="create"/>
<div id="a"></div> 
<!-- http://10.71.210.186/indexlogin.html Adminstrator -->
</body>
</html>

 <script language ="javascript">

//http://yezi.iteye.com/blog/78619

//http://www.blogjava.net/leeguannan/archive/2007/11/29/164044.html

</script>

좋은 웹페이지 즐겨찾기