⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 additem.jsp

📁 这是一个网站在线订单系统.可以删除,查询,修改
💻 JSP
字号:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>


		<title>addItem.jsp</title>

	
		
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

	</head>
	<script>
	 //这个功能用来输入货物的详细信息,并算出折扣后货物的价格,往数据库里面加一条信息
 		
 		function check(){
            
       
            //货物数量名称单价不能为空
  			if(document.f1.name.value==""){
  				
  				alert("请输入货物名称");
  			}else if(document.f1.num.value==""){
  				
  				alert("请输入货物数量");
  			}else if(document.f1.price.value==""){
  				
  				alert("请输入货物单价");
  			}
            //算出折扣号
            
  			if(document.f1.select.value=="0")
  					
  					document.f1.sumprice.value=parseInt(document.f1.num.value)*parseFloat(document.f1.price.value);
  			
  			else if(document.f1.select.value=="1"){
  					document.f1.discount.disabled = false;
  			        if(document.f1.discount.value==""){
  	
  					alert("请输入折扣率");
  					
  			        }else if(document.f1.discount.value >1 ||document.f1.discount.value<=0){
  			     			alert("请输入0-1之间的折扣率");
  			     	   }
  			        
  			        {
  					
  					document.f1.sumprice.value=parseInt(document.f1.num.value)*parseFloat(document.f1.price.value)*parseFloat(document.f1.discount.value);
  			
  					}
  			}else{
  					  document.f1.number.disabled = false;
       				 document.f1.promoteprice.disabled = false;
  					if(document.f1.number.value=="")
  							
  						alert("请输入促销数量");
  					else if(parseInt(document.f1.number.value)>parseInt(document.f1.num.value))
  						
  						alert("促销数量大于总数目了!");
  					
  					else if(document.f1.promoteprice.value=="")
  						
  						alert("请输入促销价格");
  					
  					else{
  						
  						document.f1.sumprice.value=(parseInt(document.f1.num.value)-parseInt(document.f1.number.value))*parseFloat(document.f1.price.value)+parseInt(document.f1.number.value)*parseFloat(document.f1.promoteprice.value)
  					}
            }
            if(isNaN(document.f1.sumprice.value)){
  					alert("请输入整数!");
  		}
  		}
  
  </script>
	<body vlink="red">
		<form name="f1" method="post" action="/Order/servlet/AddItem">
			<a href="/Order/servlet/SearchAll">返回订单列表<a>-><a href="/Order/servlet/ViewOrder">返回订单详情页面<a>->添加订单明细:<br>
							<table border="1">
								<tr>

									<td colspan="2" align="center">
										当前订单号
										<%=request.getParameter("orderId")%>
										<input type="hidden" name="orderId"
											value=<%=request.getParameter("orderId")%>>
									</td>
								</tr>
								<tr>
									<td align="center">
										货物名称
										<input type="text" name="name">
									</td>
									<td align="center">
										折扣类型
										<select name="select" onBlur=check()>
											<option value="0">
												无折扣
											<option value="1">
												有折扣
											<option value="2">
												有促销
										</select>
									</td>
								</tr>
								<tr>
									<td align="center">
										货物数量
										<input type="text" name="num" onBlur=check()>
									</td>
									<td align="center">
										货物单价
										<input type="text" name="price" onBlur=check()>
									</td>
								</tr>
								<tr>
									<td align="center">
										货物总价
										<input type="text" name="sumprice">
									</td>
									<td align="center">
										折扣率
										<input type="text" name="discount" onBlur=check()>
									</td>
								</tr>
								<tr>
									<td align="center">
										促销数量
										<input type="text" name="number" onBlur=check()>
									</td>
									<td align="center">
										促销单价
										<input type="text" name="promoteprice" onBlur=check()>
									</td>
								</tr>
								<tr>
									<td colspan="2" align="center">
										<input type="submit" name="sub" value="确认">
									</td>
									<td valign="top">
										<br>
									</td>
								</tr>


							</table>
		</form>
	</body>
	<script>
	   //初始化货物数量和价格为零
        document.f1.num.value=0;
        document.f1.price.value=0;
        document.f1.sumprice.disabled = "disabled";
        document.f1.discount.disabled = true;
        document.f1.number.disabled = true;
        document.f1.promoteprice.disabled = true;

        
        
  </script>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -