📄 addpro.asp
字号:
<!--#include file="conn.asp"-->
<%
if session("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录!');history.go(-1);</script>"
response.End
else
if request.cookies("sundxshop")("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录!');history.go(-1);</script>"
response.End
end if
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]);
}
}
}
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 Prolist",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" ><%
set rsMark=server.createobject("adodb.recordset")
rsMark.open "select * from Mark order by MarkTop ",conn,1,1
%>
<select name="SelectMark" onChange="(document.myform.mark.value=this.options[this.selectedIndex].value)">
<option selected>请选择类别</option>
<% Do While Not rsMark.Eof %>
<option value="<% = Trim(rsMark("MarkName")) %>"><% = rsMark("MarkName")%></option>
<%
rsMark.movenext
Loop
rsMark.close
set rsMark=nothing
%>
</select></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" 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=2000 to 2010
response.write "<option value="&i&">"&i&"</option>"
next
%>
</select>
年
<select name="productdatemonth" id="productdatemonth">
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</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">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</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="price3" type="text" id="price3" 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="price1" type="text" id="price1" 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="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'))">
元,附加邮费:
<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'))">
元
</td>
</tr>
<tr>
<td><input name="prestock" type="text" id="prestock" value="<% =rs(5) %>" size="10"></td>
<td > 库 存:
<INPUT NAME="stock" VALUE="1" SIZE="6" TYPE="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'))">
分(库存为0显示缺货,库存小于0商品隐藏)</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" value="精品" 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="30"></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 height="25"></td>
<td>是否推荐<select name="recommend" id="recommend">
<option value="0" selected>普通商品</option>
<option value="1">推荐商品</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"-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -