3.源代码(代码运⾏在tomcat上)
Shopping.html
<!DOCTYPE html>
<!--suppress ALL -->
<html lang="en">
<head>
<meta charset="UTF-8">
<title>购物车</title>
<SCRIPT LANGUAGE="javascript">
<!--
function CheckSubmit()
{
if( derform.name.value == "" )
{ alert("购买⼈姓名!"); derform.name.focus(); return false; }
if( derform.phonenumber.value == "" )
{ alert("请输⼊!"); derform.phonenumber.focus(); return false; }                if( derform.city.value == "" )
{ alert("请输⼊购买⼈所在城市!"); derform.city.focus(); return false; }                if( derform.address.value == "" )
{ alert("请输⼊详细地址!"); derform.address.focus(); return false; }
return true;
}
</SCRIPT>
</head>
<body>
<div align="center">
<table width="750" border="0" cellspacing="1" cellpadding="1">
<tr>
<td ><div align="center">
<table width="80%" border="0" cellpadding="1" cellspacing="1" class="td">
<form name="orderform" action="Shopping.jsp" method="post">
<tr align="center">
<td colspan="2">
<font color="red">
为保证您能够及时收到所选择的货品,请如实填写以下信息。
</font>
</td>
</tr>
<tr>
<td width="30%"align="right">购买⼈姓名:</td>
<td align="left"><input name="name" type="text" size="20">
</td>
</tr>
<tr>
<td align="right">:</td>
<td align="left">
<input name="phonenumber" type="text" size="20">
</td>
</tr>
<tr>
<td align="right">所在城市:</td>
<td align="left"><input name="city" type="text" size="20"></td>
</tr>
<tr>
<td align="right">详细地址:</td>
<td align="left"><input name="address" type="text" size="50"></td>
</tr>
<tr>
<td align="right">付款⽅式:</td>
<td align="left">
<select name="paying">
<option value="1">邮政汇款</option>
<option value="2" selected="selected">货到付款</option>
</select>
</select>
</td>
</tr>
<tr>
<td colspan="2" align="center"> 
</td>
</tr>
<tr>
<td align="right"> </td>
<td align="left">
<input name="submit" type="submit" value=" 确定 "
onClick="return CheckSubmit();">
<input name="reset" type="reset" value=" 重新填写 ">
</td>
</tr>
</form>
</table>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>
Shopping.jsp
<%@ page contentType="text/html; charset=UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
%>
<html>
<head>
<script language="JavaScript">
<!--
function closer(){
window.close();
}
-
->
</script>
</head>
javascript说明<body>
<div align="center">
<%
String name = Parameter("name");
String phonenumber = Parameter("phonenumber");
String city = Parameter("city");
String address = Parameter("address");
String paying = Parameter("paying");
%>
<table width="750" border="0" cellspacing="1" cellpadding="1">
<tr>
<td ><div align="center">
<table width="80%" border="0" cellpadding="1" cellspacing="1" class="td">          <tr>
<td colspan="2" align="center">
<font color="red">客户您好,以下是您提交的订货单信息,谢谢您。</font>        </td>
</tr>
<tr>
<td colspan="2" align="center">
 
</td>
</tr>
</tr>
<tr>
<td width="40%"align="right">购买⼈姓名:</td>
<td align="left">
<%out.println(name);%>
</td>
</tr>
<tr>
<td align="right">:</td>
<td align="left">
<%out.println(phonenumber);%>
</td>
</tr>
<tr>
<td align="right">所在城市:</td>
<td align="left">
<%out.println(city);%>
</td>
</tr>
<tr>
<td align="right">详细地址:</td>
<td align="left">
<%out.println(address);%>
</td>
</tr>
<tr>
<td align="right">付款⽅式:</td>
<td align="left">
<%
if(paying.equals("1")) out.println("邮政汇款");
else out.println("货到付款");
%>
</td>
</tr>
<tr>
<td colspan="2" align="center">
 
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type=button value="Close" onClick="closer()">        </td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。