JS implements the method of clicking a button to automatically add a cell

  • 2020-05-12 02:10:23
  • OfStack

The example in this article shows how JS can automatically add one cell to the click of a button. Share with you for your reference. The specific analysis is as follows:

This is a web page online self - generated form effect code.
The core function code is JS implementation, click the add button in the page, the page will automatically add 1 cell


<HTML>
<HEAD>
<TITLE>js Dynamically generated table </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=' Dynamically generated table ' onclick=creates()><br>
</body>
</HTML>

I hope this article has helped you with your javascript programming.


Related articles: