<head>
<title>增 加</title>
<STYLE type=text/css>
A:link {COLOR: #000000; FONT-FAMILY: 宋体; TEXT-DECORATION: none}
A:visited {	COLOR: #000000; FONT-FAMILY: 宋体; TEXT-DECORATION: none}
A:active { COLOR: #ff0000; FONT-FAMILY: 宋体; TEXT-DECORATION: none}
A:hover {COLOR: #ff0000; TEXT-DECORATION: none}
BODY {FONT-SIZE: 9pt}
TH {FONT-SIZE: 9pt}
TD {FONT-SIZE: 9pt}
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
function check()
{
	if(form1.name.value.length<1)	
	{
		alert("商品名称不能为空") ;
		return false;
	}
	if(form1.html.value.length<1)	
	{
		alert("商品代码不能为空") ;
		return false;
	}
	if(form1.facies.value.length<1)	
	{
		alert("效果图路径不能为空") ;
		return false;
	}
	var i=form1.price.value
	if(isNaN(i)!=false||(i="")||(form1.price.value.length<1))
	{
		alert("价格必须为数字！") ;
		return false;
	}

	var i=form1.level.value
	if(isNaN(i)!=false||(i="")||(form1.level.value.length<1))
	{
		alert("级别必须为数字！") ;
		return false;
	}

	var i=form1.quantity.value
	if(isNaN(i)!=false||(i="")||(form1.quantity.value.length<1))
	{
		alert("存货数量必须为数字！") ;
		return false;
	}
	
	if(form1.html.value != form1.facies.value)
	{
		alert("商品代码　和　效果图路径　必须相同！！！") ;
		return false ;
	}

	
	
	return true;
}
</script>


</head>

<body bgcolor="#396BA5">

<!--#include file="conn.asp"-->
<%if session("admin")="administrator" then
		IF request.form("bz")="" then 
	%>
<form method="POST" name="form1" action="addnew.asp" onsubmit="return check();">
<input type=hidden name=bz value="12345"> 
<div align="center">
  <center>

<table border="0" width="500" cellspacing="1" cellpadding="3" height="301">
  <tr>
    <td width="100%" colspan="2" bgcolor="#C6C6C6" height="27" style="border-style: ridge; border-width: 1">
      <p align="center">增 加 新 的 商 品</td>  
  </tr>  
  </center>  
  <tr>  
    <td width="42%" bgcolor="#F7F7F7" height="25">  
      <p align="right">商品名称:</td>  
    <center>  
    <td width="58%" bgcolor="#F7F7F7" height="25"><input type="text" name="name" size="25"></td>  
  </tr>  
  </center>  
  <tr>  
    <td width="42%" bgcolor="#F7F7F7" height="25">  
      <p align="right">商品代码:</td>  
    <center>  
    <td width="58%" bgcolor="#F7F7F7" height="25"><input type="text" name="html" size="50"></td>  
  </tr>  
  <tr>  
    <td width="42%" bgcolor="#F7F7F7" height="25">  
      <p align="right">效果图路径:</td>  
    <td width="58%" bgcolor="#F7F7F7" height="25"><input type="text" name="facies" size="50"></td>  
  </tr>  
  <tr>  
    <td width="42%" bgcolor="#F7F7F7" height="25">  
      <p align="right">价格:</td>  
    <td width="58%" bgcolor="#F7F7F7" height="25"><!--webbot bot="Validation"
      S-Data-Type="Integer" S-Number-Separators="x" --><input type="text" name="price" size="12"></td>  
  </tr>  
  <tr>  
    <td width="42%" bgcolor="#F7F7F7" height="25">  
      <p align="right">可使用的级别:</td>  
    <td width="58%" bgcolor="#F7F7F7" height="25"><!--webbot bot="Validation"
      S-Data-Type="Integer" S-Number-Separators="x" --><input type="text" name="level" size="12"></td>  
  </tr>  
  </center>  
  <tr>  
    <td width="42%" bgcolor="#F7F7F7" height="25">  
      <p align="right">存货数量:</td>  
    <center>  
    <td width="58%" bgcolor="#F7F7F7" height="25"><!--webbot bot="Validation"
      S-Data-Type="Integer" S-Number-Separators="x" --><input type="text" name="quantity" size="12"></td>  
  </tr>  
  </center>  
  <tr>  
    <td width="42%" bgcolor="#F7F7F7" height="25">  
      <p align="right">商品类型:</td>  
    <center>  
    <td width="58%" bgcolor="#F7F7F7" height="25">
     <SELECT name="type">
 	<%for i=0 to zlmmx %>   
		<OPTION value=<% =zlm(i,1) %>><% =zlm(i,0) %></OPTION>
	<%next%>    
	</SELECT>
    </td>  
  </tr>  
  </center> 
  <tr>  
    <td width="42%" bgcolor="#F7F7F7" height="25">  
      <p align="right">商品简介:</td>  
    <center>  
    <td width="58%" bgcolor="#F7F7F7" height="25"><input type="text" name="memo" size="50"></td>  
  </tr>  
  <tr>  
    <td width="100%" colspan="2" bgcolor="#C0C0C0" height="27" style="border-style: ridge; border-width: 1">  
    <input type=hidden name=bz value="12345">   
	 
  
      <p align="center"><input type="submit" value="提  交" name="B1">     
    </td>  
  </tr>  
</table>  

  </center> 
</div> 
</form>     
<%  
			 
		else  
			set rs=Server.CreateObject("ADODB.RecordSet")                          
			Rs.open "Select * from Products",conn,1,3
			rs.addnew
			rs("Productname")=replace(request.form("name"),"'","")
			rs("Producthtml")=replace(request.form("html"),"'","")
			rs("facies")=replace(request.form("facies"),"'","")
			rs("price")=request.form("price") 
			rs("Productlevel")=request.form("level") 
			rs("quantity")=request.form("quantity") 
			rs("type")=request.form("type") 
			rs("memo")=replace(request.form("memo"),"'","")
			rs.update
			rs.close
			response.redirect("shop.asp?id="&session("idid")&"")  
		end if  
	else  
	response.redirect("shop.asp?id="&session("idid")&"")  
end if  
conn.close  
%>