📄 editbook.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="../ubb.asp"-->
<!--#include file="session3.asp"-->
<%
dim bookid
bookid=request.QueryString("id")
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<%dim count
set rs=server.createobject("adodb.recordset")
rs.open "select * from wq_sort2 order by Nclassidorder ",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("Nclass"))%>","<%= rs("anclassid")%>","<%= rs("Nclassid")%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.myform.Nclassid.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{ //这句不是很理解
document.myform.Nclassid.options[document.myform.Nclassid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
<body>
<table cellpadding="3" cellspacing="1" border="0" width="100%" class="tableBorder" align=center>
<tr>
<th class="tableHeaderText" colspan=4 height=25>修改商品</th>
</tr>
<tr>
<form name="myform" method="post" action="saveaddbook.asp?action=edit&id=<%=bookid%>">
<td height="126" class="forumRowHighlight" >
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td width="30%" align="right"> 选择分类 </td>
<td colspan="2">
<%dim rs1
set rs1=server.CreateObject("adodb.recordset")
rs1.open "select * from wq_books where bookid="&bookid,conn,1,1
rs.open "select * from wq_sort order by anclassidorder",conn,1,1
if rs.eof and rs.bof then
response.write "请先添加栏目。"
response.end
else
%>
<select name="anclassid" size="1" id="anclassid" onChange="changelocation(document.myform.anclassid.options[document.myform.anclassid.selectedIndex].value)">
<%do while not rs.eof%>
<option value="<%=rs("anclassid")%>" <%if rs1("anclassid")=rs("anclassid") then%>selected<%end if%>><%=trim(rs("anclass"))%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
小类:<select name="Nclassid">
<%rs.open "select * from wq_sort2 where anclassid="&rs1("anclassid") ,conn,1,1
do while not rs.eof%>
<option value="<%=rs("NclassID")%>" <%if rs1("nclassid")=rs("nclassid") then%>selected<%end if%>><%=rs("Nclass")%></option>
<% rs.movenext
loop
rs.close
set rs = nothing
%>
</select>
</td>
</tr>
<tr>
<td align="right"> 商品名称 </td>
<td colspan="2">
<input name="bookname" type="text" id="bookname" size="30" value="<%=trim(rs1("bookname"))%>">浮动价
<select name="fudongjia" size=1>
<%set rs_s=server.createobject("adodb.recordset")
rs_s.open "select * from wq_float order by id ",conn,1,1
if rs_s.recordcount=0 then
response.write "请先添加浮动价"
else
while not rs_s.eof
%>
<option value=<%=rs_s("id")%><%if rs1("banci")=rs_s("id") then%> selected<%end if%>><%=rs_s("shuoming")%></option>
<%
rs_s.movenext
wend
end if
rs_s.close
set rs_s=nothing%>
</select>
</td>
</tr>
<tr>
<td align="right"> 商品品牌 </td>
<td colspan="2"><input name="pingpai" type="text" id="pingpai" size="20" value="<%=trim(rs1("pingpai"))%>">
<%
set rs_s=server.createobject("adodb.recordset")
rs_s.open "select * from wq_pingpai order by pingpaiorder ",conn,1,1
%>
<select name="select" onChange="(document.myform.pingpai.value=this.options[this.selectedIndex].value)">
<option selected>请选择品牌</option>
<%while not rs_s.eof%><option value="<%=rs_s("pingpainame")%>"><%=rs_s("pingpainame")%></option>
<%
rs_s.movenext
wend
rs_s.close
set rs_s=nothing
%>
</select>
</td>
</tr>
<tr>
<td align="right">商品规格 </td>
<td colspan="2">
<input name="isbn" type="text" id="isbn" size="30" value="<%=trim(rs1("isbn"))%>">
</td>
</tr>
<tr>
<td align="right">商品单位 </td>
<td colspan="2">
<input name="bookchuban" type="text" id="bookchuban" size="10" value="<%=trim(rs1("bookchuban"))%>">
<%
set rs_s=server.createobject("adodb.recordset")
rs_s.open "select * from wq_danwei order by danweiorder ",conn,1,1
%>
<select name="select2" onChange="(document.myform.bookchuban.value=this.options[this.selectedIndex].value)">
<option selected>请选择单位</option>
<%
while not rs_s.eof
%>
<option value="<%=rs_s("danweiname")%>"><%=rs_s("danweiname")%></option>
<%
rs_s.movenext
wend
rs_s.close
set rs_s=nothing
%>
</select>
</td>
</tr>
<tr>
<td align="right" valign="top"> 商品价格 </td>
<td colspan="2">市场价<input name="shichangjia" type="text" id="shichangjia" 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="<%=rs1("shichangjia")%>">
元,会员价<input name="huiyuanjia" type="text" id="huiyuanjia" 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="<%=rs1("huiyuanjia")%>">
元,VIP价
<input name="vipjia" type="text" id="vipjia" 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="<%=rs1("vipjia")%>">
元</td>
</tr>
<tr>
<td align="right"> 商品库存 </td>
<td colspan="2">库存:
<input name="kucun" type="text" id="kucun" value="<%=rs1("kucun")%>" size="8" 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'))" >
已销售:
<input name="chengjiaocount" type="text" id="chengjiaocount" value="<%=rs1("chengjiaocount")%>" size="8" 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'))" readonly>
积分:
<input name="yeshu" type="text" id="yeshu" value="<%=rs1("yeshu")%>" size="6" 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 height="18" align="right"> 商品图片 </td>
<td height="18" colspan="2">
<input name="bookpic" type="text" id="bookpic" size="30" value="<%=trim(rs1("bookpic"))%>">
<input class="button" type="button" name="Submit2" value="上传小图片" onClick="window.open('../Up_BookPic.asp?formname=myform&editname=bookpic&uppath=bookpic&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')">
</td>
</tr>
<tr>
<td height="18" align="right"></td>
<td height="18" colspan="2">
<input name="zhuang" type="text" id="zhuang" size="30" value="<%=trim(rs1("zhuang"))%>">
<input type="button" class="button" name="Submit2" value="上传大图片" onClick="window.open('../Up_BookPic.asp?formname=myform&editname=zhuang&uppath=bookpic&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')">
</td>
</tr>
<tr>
<td align="right" valign="middle"> 商品说明 </td>
<td colspan="2">
<textarea name="bookcontent" cols="46" rows="8" id="bookcontent"><%=trim(rs1("bookcontent"))%></textarea>
</td>
</tr>
<tr>
<td height="32"></td>
<td width="100%" height="32">
<input name="newsbook" type="checkbox" id="newsbook" value="1" <%if rs1("newsbook")=1 then%>checked<%end if%>>
新品
<input name="bestbook" type="checkbox" id="bestbook" value="1" <%if rs1("bestbook")=1 then%>checked<%end if%>>
推荐
<input name="tejiabook" type="checkbox" id="tejiabook" value="1" <%if rs1("tejiabook")=1 then%>checked<%end if%>>
特价
<input class="button" type="submit" name="Submit" value=" 修 改 " onClick="return check();">
</td>
</tr>
</table>
</td>
</form>
</tr>
</table>
<%rs1.close
set rs1=nothing
conn.close
set conn=nothing%>
</body>
</html>
<SCRIPT LANGUAGE="JavaScript">
<!--
function check()
{
if(checkspace(document.myform.bookname.value)) {
document.myform.bookname.focus();
alert("请输入商品名称!");
return false;
}
if(checkspace(document.myform.shichangjia.value)) {
document.myform.shichangjia.focus();
alert("请输入市场价格!");
return false;
}
if(checkspace(document.myform.huiyuanjia.value)) {
document.myform.huiyuanjia.focus();
alert("请输入会员价格!");
return false;
}
if(checkspace(document.myform.vipjia.value)) {
document.myform.vipjia.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 + -