Without further ado, I will post the js code to you directly. The specific code is as follows:
//js implements automatic table source code for inputting the number of rows and columns of tables<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Automatically create tables</title><style> type="text/css">table{width:300px;height:100px;border:#0C9 1px solid;border-collapse:collapse;}</style><script type="text/javascript" language="javascript">function autocreate(){//Create table table=document.createElement("table");table.setAttribute("border","1");table.setAttribute("background","red");//Get row value var line=document.getElementById("line").value;//Get column value var list=document.getElementById("list").value;for(var i=0;i<=line;i++){//alert(line);//Create trvar tr=document.createElement("tr");for(var j=0;j<=list;j++){//alert(list);//Create tdvar td=document.createElement("td");tr.appendChild(td);}table.appendChild(tr);}document.getElementById("d1").appendChild(table);}</script></head><body><input type="text" id="line">Number of rows<input type="text" id="list">Number of columns<input type="button" value="Add table" onclick="autocreate()"><div id="d1" style="height:400px; width:300px;"></div></body></html>The above is the full description of the automatic generation of forms based on JavaScript code introduced to you by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to Wulin.com website!