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

📄 addpro.asp

📁 电子商务网络购物系统
💻 ASP
字号:
<!--#include file="conn.asp"-->
<%
if session("admin")="" then
response.Write "<script language='javascript'>alert('请先登录!');history.go(-1);</script>"
response.End
end if
%>
<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]);
            }        
        }
        
    }    
</script>
<body BGCOLOR="#BFD5FF">
<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> <form name="myform" method="post" action="saveaddpro.asp?action=add"> 
<td height="126" bgcolor="#FFFFFF"> 
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr> 
        <td width="8%">&nbsp;</td>
        <td width="8%">选择分类: </td>
         <td colspan="2"> <%
 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
        set rs = nothing
        conn.Close
        set conn = nothing
%>
 </select> </td>
</tr>
<tr> 
<td>属性:</td>
<td><input name="prename" type="text" id="prename" value="商品名称:" size="15"> </td>
<td colspan="2"> <input name="name" type="text" id="name" size="30"> </td>
 </tr>
<tr> 
 <td>&nbsp;</td>
<td><input name="company" type="text" id="company" value="商品品牌:" size="15"> </td>
<td colspan="2"> <input name="mark" type="text" id="mark" size="30" ></td>
 </tr>
<tr> 
<td>&nbsp;</td>
<td><input name="intro" type="text" id="intro" value="商品简介:" size="15"></td>
<td colspan="2"> <input name="introduce" type="text" id="introduce" size="30" ></td>
</tr>
<tr> 
<td height="20">&nbsp;</td>
<td height="20"><input name="predate" type="text" id="predate" value="上市日期:" size="15"></td>
<td colspan="2"> <select name="productdateyear" id="productdateyear">
<%dim i
for i=2003 to 2004
response.write "<option value="&i&">"&i&"</option>"
next
%>
 </select>年 
 <select name="productdatemonth" id="productdatemonth">
<%for i=1 to 12
response.write "<option value="&i&">"&i&"</option>"
next%>
</select>
月</td>
</tr>
 <tr> 
<td>&nbsp;</td>
<td> <input name="price" type="text" id="price" value="商品价格:" size="15"></td>
<td colspan="2">市场价: 
<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="0">元,
会员价: 
<input name="price2" type="text" id="price2" onKeyPress	= "return regInput(this,	/^\d*\.?\d{0,2}$/,		String.fromCharCode(event.keyCode))" value="0" 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="0" 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></td>
<td><input name="prestock" type="text" id="prestock" value="库存情况:" size="15"></td>
<td colspan="2">共上: 
<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="无 限 ">件,
还剩: 
<INPUT NAME="stock" VALUE="无 限 " 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>&nbsp;</td>
<td> <input name="other" type="text" id="other" value="商品等级:" size="15"></td>
            <td colspan="2"> <input name="grade" type="text" id="grade" value="精 品" size="30"></td>
 </tr>
 <tr> 
 <td></td>
<td><input name="pretype" type="text" id="pretype" value="商品型号:" size="15"></td>
<td colspan="2"><input name="type" type="text" id="type2" size="30"></td>
</tr>

                                  <tr> 
                                    <td height="9">&nbsp;</td>
                                    <td height="9"> <input name="graph" type="text" id="graph" value="商品图片:" size="15"></td>
                                    <td height="9" colspan="2"> <input name="pic" type="text" id="pic" size="30" VALUE="images/emptybook.jpg"> 
                                      &nbsp; <input type="button" name="Submit2" value="上 传" onClick="javascript:window.open('upfile.htm','','width=580,height=160,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=no');return false;"></td>
                                  </tr>
                                  <tr> 
                                    <td height="9" rowspan="3">&nbsp;</td>
                                    <td height="0"><input name="graph2" type="text" id="graph2" value="大图片:" size="15"></td>
                                    <td height="4" colspan="2"><INPUT NAME="photo" TYPE="text" ID="photo" value="images/emptybook.jpg" SIZE="30">
                                      &nbsp; 
                                      <input type="button" name="Submit2" value="上 传" onClick="javascript:window.open('upfile.htm','','width=580,height=160,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=no');return false;">
                                    </td>
                                  </tr>
                                  <tr> 
                                    
            <td height="9"><input name="link" type="text" id="link" value="下载链接:" size="15"></td>
                                    <td height="9" colspan="2"><input name="addlink" type="text" id="addlink" size="30"></td>
                                  </tr>
                                  <tr> 
                                    <td valign="top"><input name="description" type="text" id="description" value="详细说明:" size="15"> </td>
                                    <td colspan="2"> <textarea name="detail" cols="46" rows="8" id="detail"> </textarea> 
                                    </td>
                                  </tr>
                                  <tr> 
                                    <td valign="top">&nbsp;</td>
                                    <td valign="top"><input name="remarks" type="text" id="remarks" value="商品备注:" size="15"></td>
                                    <td colspan="2"><TEXTAREA NAME="content" COLS="46" ROWS="8" ID="content"> </TEXTAREA> 
                                    </td>
                                  </tr>
                                  <tr> 
                                    <td height="32" colspan="2"> <div align="center"> 
                                      </div></td>
                                    <td width="32%" height="32"> <div align="center">
                <input name="recommend" type="checkbox" id="recommend" value="1">
                推荐此商品 
                <input type="submit" name="Submit" value="添 加" onClick="return checkpro();">
                                      </div></td>
                                    
            <td width="52%">&nbsp; </td>
                                  </tr>
                                </table></td></form></tr> </table>

<br> <!--#include file="footer.asp"-->
</body>
</html>

<SCRIPT LANGUAGE="JavaScript">
<!--
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>

⌨️ 快捷键说明

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