日期:2014-05-16 浏览次数:20456 次
<html> <head></head> <script language="javascript"> <!-- function compute(){ return true; } --> </script> <BR>send the Length and Width to calculate.jsp throught click submit <form name="form2" target="myWindowName" action="calculate.jsp" method="post" onSubmit="compute()"> <br>Lenght:<input type="text" name="Len" value="30" size="5"> <br>Width:<input type="text" name="Width" value="30" size="5"> <p><input type="submit" name="mysubmit" value="submit"></p> </form> </body> </html>
<html>
<head> </head>
<script language="javascript">
<!--
function compute(Len,Width){
var SquarArea;
SquarArea=Len*Width;
document.write("WindowName="+window.name+" <br>");
document.write("get Len="+Len+" <br>");
document.write("get Width="+Width+" <br>");
document.write("SquarArea="+SquarArea);
}
-->
</script>
<body>
get length and width from onsubmit.jsp <br>
<form name="123" action="" method="post">
<input type="button" name="button1" value="calculate" onClick="compute( <%=request.getParameter("Len")%>, <%=request.getParameter("Width")%>)">
</form>
</body>
</html>