<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../images/css.css" type=text/css rel=stylesheet>
<LINK href="../list/newhead.css" type=text/css rel=stylesheet>
<script language="JavaScript" type="text/JavaScript">
function JM_wu(ob){
 ob.style.display="none";
}
function JM_you(ob){
 ob.style.display="";
}
function uppic(model,frmname) {
 id=document.prodtable.ProdId.value;
 if (id=='') {
 alert("请先填写商品编号！");
 document.prodtable.ProdId.focus();
return false;}
window.open("upload.asp?fuptype=pic&fupname="+id+model+"&frmname="+frmname,"blank_","scrollbars=yes,resizable=no,width=650,height=450")
}

function CheckAll(form) {
 for (var i=0;i<form.elements.length;i++) {
 var e = form.elements[i];
 if (e.name != 'chkall') e.checked = form.chkall.checked; 
 }
 }
</script>
</head>
<%
if request.cookies("buyok")("admin")="" then response.write "<meta http-equiv='refresh' content='0;URL=../admin.asp'>"
%>
<!--#include file="../include/config.asp"-->

<script language=javascript src=../include/mouse.js></script>
<%
sub checkmanage(str)
Set mrs = conn.Execute("select * from manage where username='"&request.cookies("buyok")("admin")&"'")
if not (mrs.bof and mrs.eof) then
manage=mrs("manage")
if instr(manage,str)<=0 then
response.write "<script language='javascript'>"
response.write "alert('警告：您没有此项操作的权限！');"
response.write "location.href='quit.asp';"
response.write "</script>"
response.end
else
session("buyok_admin_login")=0
end if
else 
response.write "<script language='javascript'>"
response.write "alert('没有登陆，不能执行此操作！');"
response.write "location.href='quit.asp';"
response.write "</script>"
response.end
end if
set mrs=nothing
end sub
%>
<title>添加新商品</title>
<%
dim count
set rs=server.createobject("adodb.recordset")
rs.open "select * from sorts order by sortsorder ",conn,1,1%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
   count = 0
   do while not rs.eof 
%>
subcat[<%=count%>] = new Array("<%= trim(rs("sorts"))%>","<%= rs("categoryid")%>","<%= rs("sortsid")%>");
<%
        count = count + 1
        rs.movenext
        loop
        rs.close
%>
		
onecount=<%=count%>;

function changelocation(locationid)
    {
    document.myform.sortsid.length = 0; 

    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
             document.myform.sortsid.options[document.myform.sortsid.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
        
    }    

function checkpro()
{
    if(checkspace(document.myform.name.value)) {
	document.loginfo.username.focus();
    alert("请输入商品名称！");
	return false;
  }

     if(checkspace(document.myform.price1.value)) {
	document.myform.price1.focus();
    alert("请输入商品市场价格！");
	return false;
  }
     if(checkspace(document.myform.price2.value)) {
	document.myform.price2.focus();
    alert("请输入商品会员价格！");
	return false;
  }
      if(checkspace(document.myform.vipprice.value)) {
	document.myform.vipprice.focus();
    alert("请输入VIP月会员商品价格！");
	return false;
  }
 
}
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
	function regInput(obj, reg, inputStr)
	{
		var docSel	= document.selection.createRange()
		if (docSel.parentElement().tagName != "INPUT")	return false
		oSel = docSel.duplicate()
		oSel.text = ""
		var srcRange	= obj.createTextRange()
		oSel.setEndPoint("StartToStart", srcRange)
		var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
		return reg.test(str)
	}
//-->
</script>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#6B8FC8"> 
<tr> <td bgcolor="#6699cc" height="20" align="center"><font color="#FFFFFF">添加新商品</font></td></tr> 
<tr>  
<td bgcolor="#FFFFFF"> 
<form name="myform" method="post" action="saveaddpro.asp?action=add">
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="0">
          <tr> 
            <td width="5%">选择分类： </td>
            <td> <%
 rs.open "select * from category order by categoryorder",conn,1,1
if rs.eof and rs.bof then
response.write "请先添加商品大类。"
response.end
else
%> <select name="categoryid" size="1" id="categoryid" onChange="changelocation(document.myform.categoryid.options[document.myform.categoryid.selectedIndex].value)">
                <option selected value="<%=rs("categoryid")%>"><%=trim(rs("category"))%></option>
                <%      
 dim selclass
 selclass=rs("categoryid")
 rs.movenext
 do while not rs.eof
%>
                <option value="<%=rs("categoryid")%>"><%=trim(rs("category"))%></option>
                <%
 rs.movenext
 loop
end if
rs.close
%>
              </select>
              小类： 
              <select name="sortsid">
                <%rs.open "select * from sorts where categoryid="&selclass ,conn,1,1
if not(rs.eof and rs.bof) then
%>
                <option selected value="<%=rs("sortsid")%>"><%=rs("sorts")%></option>
                <% rs.movenext
do while not rs.eof%>
                <option value="<%=rs("sortsid")%>"><%=rs("sorts")%></option>
                <% rs.movenext
loop
end if
        rs.close
		rs.open "select * from TimesProList",conn,1,1
%>
              </select> </td>
          </tr>
          <tr> 
            <td><input name="prename" type="text" id="prename" value="<% =rs(0) %>" size="10"> 
            </td>
            <td> <input name="name" type="text" id="name" size="30"> 
            </td>
          </tr>
          <tr> 
            <td><input name="company" type="text" id="company" value="<% =rs(1) %>" size="10"> 
            </td>
            <td> <input name="mark" type="text" id="mark" size="30" ></td>
          </tr>
          <tr> 
            <td><input name="intro" type="text" id="intro" value="<% =rs(2) %>" size="10"></td>
            <td> <input name="introduce" type="text" id="introduce" value="现货" size="30" ></td>
          </tr>
          <tr> 
            <td height="20"><input name="predate" type="text" value="<% =rs(3) %>" size="10"></td>
            <td > <select name="productdateyear" id="productdateyear">
                <%dim i
for i=2006to 2016
response.write "<option value="&i&">"&i&"</option>"
next
%>
              </select>
              年 
              <select name="productdatemonth" id="productdatemonth">
                <option value="01">1</option>
                <option value="02">2</option>
                <option value="03">3</option>
                <option value="04">4</option>
                <option value="05">5</option>
                <option value="06">6</option>
                <option value="07">7</option>
                <option value="08">8</option>
                <option value="09">9</option>
                <option value="10">10</option>
                <option value="11">11</option>
                <option value="12">12</option>
              </select>
              月 <select name="productdateday" id="productdateday">
                <option value="01">1</option>
                <option value="02">2</option>
                <option value="03">3</option>
                <option value="04">4</option>
                <option value="05">5</option>
                <option value="06">6</option>
                <option value="07">7</option>
                <option value="08">8</option>
                <option value="09">9</option>
                <option value="10">10</option>
                <option value="11">11</option>
                <option value="12">12</option>
                <option value="13">13</option>
                <option value="14">14</option>
                <option value="15">15</option>
                <option value="16">16</option>
                <option value="17">17</option>
                <option value="18">18</option>
                <option value="19">19</option>
                <option value="20">20</option>
                <option value="21">21</option>
                <option value="22">22</option>
                <option value="23">23</option>
                <option value="24">24</option>
                <option value="25">25</option>
                <option value="26">26</option>
                <option value="27">27</option>
                <option value="28">28</option>
                <option value="29">29</option>
                <option value="30">30</option>
                <option value="31">31</option>
              </select>
              日</td>
          </tr>
          <tr> 
            <td> <input name="price" type="text" id="price" value="<% =rs(4) %>" size="10"></td>
            <td >市场价： 
              <input name="price1" type="text" id="price1" size="6" onKeyPress	= "return regInput(this,	/^\d*\.?\d{0,2}$/,		String.fromCharCode(event.keyCode))" 
onpaste		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		window.clipboardData.getData('Text'))"
ondrop		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		event.dataTransfer.getData('Text'))" VALUE="1">
              元， 会员价： 
              <input name="price2" type="text" id="price2" onKeyPress	= "return regInput(this,	/^\d*\.?\d{0,2}$/,		String.fromCharCode(event.keyCode))" value="1" size="6" 
onpaste		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		window.clipboardData.getData('Text'))"
ondrop		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		event.dataTransfer.getData('Text'))">
              元， VIP价： 
              <INPUT NAME="vipprice" TYPE="text" ID="vipprice" ONKEYPRESS	= "return regInput(this,	/^\d*\.?\d{0,2}$/,		String.fromCharCode(event.keyCode))" value="1" SIZE="6" 
ONPASTE		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		window.clipboardData.getData('Text'))"
ONDROP		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		event.dataTransfer.getData('Text'))">
              元， 赠送积分： 
              <INPUT NAME="score" VALUE="1" SIZE="4" TYPE="text" ONKEYPRESS	= "return regInput(this,	/^[0-9]*$/,		String.fromCharCode(event.keyCode))"
ONPASTE		= "return regInput(this,	/^[0-9]*$/,		window.clipboardData.getData('Text'))"
ONDROP		= "return regInput(this,	/^[0-9]*$/,		event.dataTransfer.getData('Text'))">
              分</td>
          </tr>
          <tr> 
            <td><input name="prestock" type="text" id="prestock" value="<% =rs(5) %>" size="10"></td>
            <td >共　上： 
              <INPUT NAME="amount" SIZE="6" TYPE="text" ONKEYPRESS	= "return regInput(this,	/^[0-9]*$/,		String.fromCharCode(event.keyCode))"
ONPASTE		= "return regInput(this,	/^[0-9]*$/,		window.clipboardData.getData('Text'))"
ONDROP		= "return regInput(this,	/^[0-9]*$/,		event.dataTransfer.getData('Text'))" VALUE="1">
              件， 库　存： 
              <INPUT NAME="stock" VALUE="1" SIZE="6" TYPE="text" ONKEYPRESS	= "return regInput(this,	/^[0-9]*$/,		String.fromCharCode(event.keyCode))"
ONPASTE		= "return regInput(this,	/^[0-9]*$/,		window.clipboardData.getData('Text'))"
ONDROP		= "return regInput(this,	/^[0-9]*$/,		event.dataTransfer.getData('Text'))">
              件</td>
          </tr>
          <tr> 
            <td> <input name="other" type="text" id="other" value="<% =rs(6) %>" size="10"></td>
            <td> <input name="grade" type="text" id="grade" size="30"></td>
          </tr>
          <tr> 
            <td><input name="pretype" type="text" id="pretype" value="<% =rs(7) %>" size="10"></td>
            <td><input name="type" type="text" id="type2" size="30"></td>
          </tr>
          <tr> 
            <td height="9"> <input name="graph" type="text" id="graph" value="<% =rs(8) %>" size="10"></td>
            <td> <input name="pic" type="text" id="pic" size="30" VALUE="images/emptybook.jpg"> 
              <input type="button" name="Submit11" value="上传图片" onClick="window.open('upfile.asp?formname=myform&editname=pic&uppath=images/upfile&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')"> 
            </td>
          </tr>
          <tr> 
            <td height="9"><input name="graph2" type="text" id="graph2" value="<% =rs(9) %>" size="10"></td>
            <td height="9"><INPUT NAME="photo" TYPE="text" ID="photo" SIZE="30">
            </td>
          </tr>
          <tr> 
            <td height="9"><input name="link" type="text" id="link" value="<% =rs(10) %>" size="10"></td>
            <td height="9"><input name="addlink" type="text" id="addlink" size="150"></td>
          </tr>
          <tr> 
            <td valign="top"><input name="description" type="text" id="description" value="<% =rs(11) %>" size="10"> 
            </td>
            <td> <INPUT type="hidden" name="detail" value="<% =rs(11) %>">	
              <iframe ID="detail" src="htmledit/ewebeditor.asp?id=detail&style=standard" frameborder="0" scrolling="no" width="550" HEIGHT="350"></iframe> 
            </td>
          </tr>
          <tr> 
            <td valign="top"><input name="remarks" type="text" id="remarks" value="<% =rs(12) %>" size="10"></td>
            <td><INPUT type="hidden" name="content" value="<% =rs(12) %>"> 
              <iframe ID="content" src="htmledit/ewebeditor.asp?id=content&style=standard" frameborder="0" scrolling="no" width="550" HEIGHT="350"></iframe> 
            </td>
          </tr>
          <tr> 
            <td height="25"></td>
            <td>商品类别 <select name="recommend" id="recommend">
                <option value="0" selected>普通商品</option>
                <option value="1">推荐商品</option>
                <option value="2">特价商品</option>
                <option value="3">新品上架</option>
                <option value="4">推荐特价</option>
                <option value="5">推荐新品</option>
                <option value="6">新品特价</option>
                <option value="7">赠送礼品</option>
              </select> <input type="submit" name="Submit" value="添 加" onClick="return checkpro();"> 
            </td>
            <% rs.close
        set rs = nothing
        conn.Close
        set conn = nothing %>
          </tr>
        </table></form></td></tr> </table>
<!--#include file="footer.asp"-->