您的位置:首页 > Web前端 > JavaScript

JS实现点击按钮自动增加一个单元格

2015-11-16 16:28 826 查看
代码如下:

<HTML>

<HEAD>

<TITLE>js动态生成表格</TITLE>

<META content="text/html; charset=hz-gb-2312" http-equiv=Content-Type>

</HEAD>

<script>

function creates(){

newiframes=document.createElement("TABLE")

newiframes.id="t1"

newiframes.width="100"

newiframes.border="1"

newiframes.height="100"

newiframes.align="left"

newiframes.style.background="blue"

newiframes.insertRow()

newiframes.rows[0].insertCell()

document.body.insertBefore(newiframes)

}

</script>

<body>

<input type=button value='动态生成表格' onclick=creates()><br>

</body>

</HTML>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: