<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%><!DOCTYPE html><html><head><meta charset="UTF-8"><title>Insert title here</title></head><body>
行:<input type="text" id="hang"/><br>
列:<input type="text" id="lie"/><br><input type="button" value="生成" onclick="con();"/><div id ="divv"></div><script type="text/javascript">// 动态生成表格************************************
function con(){var tab ="<table border='1' bordercolor='blue'>";var h = document.getElementById("hang").value;var l = document.getElementById("lie").value;// alert(h);// alert(l);for(var i =0;i<h;i++){
tab+="<tr>";for(var j=0;j < l;j++){
tab+="<td>aaaaaaaaaaaaaa</td>";}
tab+="</tr>";}
tab +="</table>";var divv = document.getElementById("divv");
divv.innerHTML=tab;}</script></body></html>
表单提交方式
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%><!DOCTYPE html><html><head><meta charset="UTF-8"><title>Insert title here</title></head><body><form id="form1"><input type ="text" id ="id1" value="请输入:" name ="username" onfocus="focus1();" onblur="blur1();"/><br><input type ="button" value ="提交" onclick="formone();"/></form><script type="text/javascript">
function formone(){var f = document.getElementById("form1");
f.action="login.jsp";
f.submit();}
function focus1(){var inp= document.getElementById("id1");
inp.value="";}
function blur1(){var inp= document.getElementById("id1");
inp.value="请输入:";}</script></body></html>