用JS实现乘法表

来源:互联网 发布:mac怎么用搜狗输入法 编辑:程序博客网 时间:2024/05/22 00:34
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title></title> <meta http-equiv="content" content="text/html"charset="utf-8"/> <style type="text/css">   </style> <script type="text/javascript"> function f1() { var tab=document.createElement('table'); tab.setAttribute('border','1'); tab.setAttribute('width','100%'); // var obd=document.createElement('tbody'); tab.appendChild(obd); // for(i=0;i<9;i++) { obd.insertRow(i); for(j=0;j<i+1;j++) { obd.rows[i].insertCell(j); obd.rows[i].cells[j].appendChild(document.createTextNode((j+1)+'x'+(i+1)+'='+(i+1)*(j+1))); } } document.body.appendChild(tab); } </script> </head>   <body> <input type="button" value="form"onclick="f1()"> </body> </html>
0 0
原创粉丝点击