📄 add_product.asp
字号:
<!--#include file="conn.asp"-->
<%call time_out()%>
<%
if instr(session("proview"),"s1")=0 then
response.Write "<script language=javascript>alert('您无权操作!');window.location.href='index.asp';</script>"
response.end
end if%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<%dim count
set rs=server.createobject("adodb.recordset")
rs.open "select * from pro_small order by smallid ",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("smallname"))%>","<%= rs("bigid")%>","<%= rs("smallid")%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.form1.smallid.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{ //这句不是很理解
document.form1.smallid.options[document.form1.smallid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
<form name="form1" method="post" action="save_product.asp?action=add">
<table width="100%" border="1" bordercolordark="#FFFFFF" bordercolorlight="#6699CC">
<tr>
<td height="25" colspan="2" align="center">添加商品</td>
</tr>
<tr>
<td height="25">所属分类:</td>
<td>
<%
rs.open "select * from pro_big order by bigid",conn,1,1
if rs.eof and rs.bof then
response.write "请先添加商品分类。"
response.end
else
%>
大类:
<select name="bigid" size="1" id="bigid" onChange="changelocation(document.form1.bigid.options[document.form1.bigid.selectedIndex].value)">
<option selected value="<%=rs("bigid")%>"><%=trim(rs("bigname"))%></option>
<% dim selclass
selclass=rs("bigid")
rs.movenext
do while not rs.eof
%>
<option value="<%=rs("bigid")%>"><%=trim(rs("bigname"))%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
小类:
<select name="smallid">
<%rs.open "select * from pro_small where bigid="&selclass ,conn,1,1
if not(rs.eof and rs.bof) then
%>
<option selected value="<%=rs("smallid")%>"><%=rs("smallname")%></option>
<% rs.movenext
do while not rs.eof%>
<option value="<%=rs("smallid")%>"><%=rs("smallname")%></option>
<% rs.movenext
loop
end if
rs.close
set rs = nothing
%>
</select> </td>
</tr>
<tr>
<td height="25">商品名称:</td>
<td><input type="text" name="pro_name"></td>
</tr>
<tr>
<td height="25">商品品牌:</td>
<td><select name="pingpai">
<%sqlp="select * from pinpai"
set rsp=server.CreateObject("adodb.recordset")
rsp.open sqlp,conn,1,3
if rsp.eof and rsp.bof then%>
<option value="">暂无品牌</option>
<%else
do while not rsp.eof%>
<option value="<%=rsp("ppid")%>"><%=rsp("ppname")%></option>
<%rsp.movenext
loop
end if
rsp.close:set rsp=nothing%>
</select>
</td>
</tr>
<tr>
<td height="25">商品价格:</td>
<td>市场价:
<input name="market_price" type="text" size="8" ONKEYPRESS = "return regInput(this, /^\d*\.?\d{0,2}$/, String.fromCharCode(event.keyCode))" value="0"
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="pt_price" type="text" size="8" ONKEYPRESS = "return regInput(this, /^\d*\.?\d{0,2}$/, String.fromCharCode(event.keyCode))" value="0"
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="vip_price" type="text" size="8" ONKEYPRESS = "return regInput(this, /^\d*\.?\d{0,2}$/, String.fromCharCode(event.keyCode))" value="0"
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 height="25">库存/积分:</td>
<td>库存数量:
<input name="kucun" type="text" size="15" ONKEYPRESS = "return regInput(this, /^\d*\.?\d{0,2}$/, String.fromCharCode(event.keyCode))" value="0"
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="jifen" type="text" size="5" ONKEYPRESS = "return regInput(this, /^\d*\.?\d{0,2}$/, String.fromCharCode(event.keyCode))" value="0"
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 height="25">规格/型号:</td>
<td>规格:
<input type="text" name="pro_type">
型号:
<input type="text" name="pro_xinghao"></td>
</tr>
<tr>
<td height="25">商品大图:</td>
<td><input name="big_pic" type="text" size="30">
<input type="button" name="Submit11" value="上传大图片" onClick="window.open('carson52001.asp?formname=form1&editname=big_pic&uppath=bookpic&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')"> </td>
</tr>
<tr>
<td height="25">商品小图:</td>
<td><input name="small_pic" type="text" size="30">
<input type="button" name="Submit112" value="上传小图片" onClick="window.open('carson52001.asp?formname=form1&editname=small_pic&uppath=bookpic&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')"></td>
</tr>
<tr>
<td height="25">商品简介:</td>
<td><INPUT type="hidden" name="jieshao">
<iframe ID="Editor" name="Editor" src="HtmlEditor/index.html?ID=jieshao" frameBorder="0" marginHeight="0" marginWidth="0" scrolling="No" style="height:320px;width:600px"></iframe> </td>
</td>
</tr>
<tr>
<td height="25" colspan="2" align="center"><input type="checkbox" name="isnew" value="1">
新品
<input type="checkbox" name="istj" value="1">
推荐
<input type="checkbox" name="istejia" value="1">
特价</td>
</tr>
<tr>
<td height="25" colspan="2" align="center">
<input type="submit" name="Submit" value="保存数据">
<input type="reset" name="Submit2" value="重新填写"> </td>
</tr>
</table>
</form>
</body>
</html>
<script>
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 + -