📄 editpro.asp
字号:
<!--#include file="conn.asp"-->
<%if session("admin")="" then
response.Write "<script language='javascript'>alert('请先登录!');history.go(-1);</script>"
response.End
end if
dim id
id=request.QueryString("id")
%>
<link href="../include/css.css" rel="stylesheet" type="text/css">
<%
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>
<table width="96%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#6B8FC8">
<tr>
<td bgcolor="#6B8FC8" align="center"><font color="#FFFFFF">编辑商品属性</font></td>
</tr>
<tr><form name="myform" method="post" action="saveaddpro.asp?action=edit&id=<%=id%>">
<td height="126" bgcolor="#FFFFFF">
<table width="92%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td width="21%">选择分类:</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
%>
<%dim rs1
set rs1=server.CreateObject("adodb.recordset")
rs1.open "select * from product where id="&id,conn,1,1
%>
<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=rs1("categoryid")
rs.movenext
do while not rs.eof
response.write "<option value="&rs("categoryid")
if rs1("categoryid")=rs("categoryid") then response.write " selected "
response.write ">"&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
response.write "<option value="&rs("sortsid")
if rs1("sortsid")=rs("sortsid") then response.write " selected "
response.write ">"&trim(rs("sorts"))&"</option>"
rs.movenext
loop
end if
rs.close
set rs = nothing
%>
</select> <font color="#FF0000"> </font></td>
</tr>
<tr>
<td> <input name="prename" type="text" id="prename" size="20" value="<%=trim(rs1("prename"))%>">
</td>
<td colspan="2"><input name="name" type="text" id="name" size="30" value="<%=trim(rs1("name"))%>"></td>
</tr>
<tr>
<td> <input name="company" type="text" id="company" size="20" value="<%=trim(rs1("company"))%>">
</td>
<td colspan="2"><input name="mark" type="text" id="mark" size="30" value="<%=trim(rs1("mark"))%>"></td>
</tr>
<tr>
<td> <input name="intro" type="text" id="intro" size="20" value="<%=trim(rs1("intro"))%>">
</td>
<td colspan="2"><input name="introduce" type="text" id="introduce" size="30" value="<%=trim(rs1("introduce"))%>"></td>
</tr>
<tr>
<td height="20"> <input name="predate" type="text" id="predate" size="20" value="<%=trim(rs1("predate"))%>">
</td>
<td colspan="2"><select name="productdateyear" id="productdateyear">
<%dim i
for i=2003 to 2010
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>
月
<select name="productdateday" id="productdateday">
<%for i=1 to 31
response.write "<option value="&i&">"&i&"</option>"
next%>
</select>
日</td>
</tr>
<tr>
<td valign="top"><input name="price" type="text" id="price" size="20" value="<%=trim(rs1("price"))%>"></td>
<td colspan="2">市场价:
<input name="price1" type="text" id="price1" size="5" 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="<%=rs1("price1")%>">
元,普通会员价
<input name="price2" type="text" id="price2" size="5" 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="<%=rs1("price2")%>">
元, VIP会员价:<font color="#FF0000"><strong>正式版</strong></font>,赠送积分:<font color="#FF0000"><strong>正式版</strong></font></td>
</tr>
<tr>
<td height="33"><input name="prestock" type="text" id="prestock" size="20" value="<%=trim(rs1("prestock"))%>"></td>
<td colspan="2">共上:
<input name="amount" type="text" id="amount" size="10" value="<%=trim(rs1("amount"))%>">
件,还剩:
<input name="stock" type="text" id="stock" size="10" value="<%=trim(rs1("stock"))%>">
件。</td>
</tr>
<tr>
<td height="19"><input name="other" type="text" id="other" size="20" value="<%=trim(rs1("other"))%>"></td>
<td colspan="2"><input name="grade" type="text" id="grade" size="20" value="<%=trim(rs1("grade"))%>"></td>
</tr>
<tr>
<td height="19"><input name="pretype" type="text" id="pretype" size="20" value="<%=trim(rs1("pretype"))%>"></td>
<td colspan="2"><input name="type" type="text" id="type2" value="<%=trim(rs1("type"))%>" size="30">
</td>
</tr>
<tr>
<td><input name="graph" type="text" id="graph" size="20" value="<%=trim(rs1("graph"))%>">
</td>
<td><input name="pic" type="text" id="pic" size="30" value="<%=trim(rs1("pic"))%>"> </td>
<td> <IFRAME src="upfile.asp" frameBorder=0 width="100%" scrolling=no height=21> </IFRAME></td>
</tr>
<tr>
<td><input name="graph2" type="text" id="graph2" size="20" value="<%=trim(rs1("graph2"))%>">
</td>
<td><input name="photo" type="text" id="photo" size="30" value="<%=trim(rs1("photo"))%>"></td>
<td> <IFRAME src="upfile1.asp" frameBorder=0 width="100%" scrolling=no height=21> </IFRAME></td>
</tr>
<tr>
<td height="4"><input name="link" type="text" id="link" size="20" value="<%=trim(rs1("link"))%>"></td>
<td height="4" colspan="2"><input name="addlink" type="text" id="addlink" value="<%=trim(rs1("addlink"))%>" size="30"></td>
</tr>
<tr>
<td valign="top"> <input name="description" type="text" id="description2" size="20" value="<%=trim(rs1("description"))%>"></td>
<td colspan="2"><textarea name="detail" cols="46" rows="8" id="detail"><%=trim(rs1("detail"))%></textarea></td>
</tr>
<tr>
<td valign="top"> <input name="remarks" type="text" id="remarks" size="20" value="<%=trim(rs1("remarks"))%>">
</td>
<td colspan="2"><textarea name="content" cols="46" rows="8" id="content"><%=trim(rs1("content"))%></textarea></td>
</tr>
<tr>
<td height="32"><div align="center"> </div></td>
<td width="29%" height="32"><div align="center">
<input name="recommend" type="checkbox" id="recommend" value="1">
推荐此商品
<input type="submit" name="Submit" value="修 改" onClick="return check();">
</div></td>
<td width="50%"> </td>
</tr>
</table>
</td></form>
</tr>
</table><%rs1.close
set rs1=nothing
conn.close
set conn=nothing%>
<br>
<!--#include file="footer.asp"-->
<SCRIPT LANGUAGE="JavaScript">
<!--
function check()
{
if(checkspace(document.myform.name.value)) {
document.myform.name.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.putongjia.focus();
alert("请输入普通会员价!");
return false;
}
if(checkspace(document.myform.vipprice.value)) {
document.myform.price2.focus();
alert("请输入VIP会员价!");
return false;
}
}
function checkspace(checkstr) {
var str = '';
for(i = 0; i < checkstr.length; i++) {
str = str + ' ';
}
return (str == checkstr);
}
//-->
</script>
<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 + -