Ohne weiteres werde ich den JS -Code direkt an Sie veröffentlichen. Der spezifische Code lautet wie folgt:
//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"> <kopf> <meta http-equiv = "content-type" content = "text/html; charset = utf-8"/> <titels> Erstellen Sie automatisch Täle </title> <style> <style> <style> <style> type = "text/CSS"> Tabelle {Breite: 300px; Höhe: 100px; Rand:#0c9 1px solide; Border-Collapse: Collapse;} </style> <script type = "text/javascript" Sprache = "JavaScript"> Funktion autocreate () {// table table table creat table table creat table table creat table table creat table " table = document.createelement ("table"); table.setAttribute ("border", "1"); table.setAttribute ("Hintergrund", "rot"); // Zeilenwert var line = document.getElementById ("Zeile"). Value; // Spaltenwertvariabliste = document. i = 0; i <= Zeile; i ++) {// alert (Zeile); // erstellen trvar tr = document.createelement ("tr"); für (var j = 0; j <= list; j ++) {// alert (list); // TDVAR erstellen TDVAR erstellen 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 = "table add table" onclick = "autocreate ()"> <div id = "d1" style = "height: 400px; width: 300px;"> </div> </body> </html>Das obige ist die vollständige Beschreibung der automatischen Generation von Formularen basierend auf dem vom Editor vorgestellten JavaScript -Code. Ich hoffe, es wird Ihnen hilfreich sein. Wenn Sie Fragen haben, hinterlassen Sie mir bitte eine Nachricht und der Editor wird Ihnen rechtzeitig antworten. Vielen Dank für Ihre Unterstützung auf der Wulin.com -Website!