<div id="box"> </div> <script src="vue-2.4.0.js"></script> <script> var row=Number(prompt("请输出表格的行数")); var col=Number(prompt("请输入表格的列数")); var str="<table>"; for(var i=0;i<row;i++){ str+="<tr>" for(var j=0;j<col;j++){ str+="<td></td>" } str+="</tr>" } str+="</table>"; var div=document.getElementById('box'); div.innerHTML=str; </script>