epro.asp
Upload User: syzzy1975
Upload Date: 2022-07-17
Package Size: 670k
Code Size: 14k
Category:

Jsp/Servlet

Development Platform:

Java

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
  2. <%
  3. %><!--#include file="inc/config.asp"-->
  4. <!--#include file="inc/conn.asp"--> 
  5. <!--#include file="inc/chk.asp"--> 
  6. <%
  7. if session("rank")>1 then
  8. call Msgbox("对不起,您的权限不够!","Back","None")
  9. response.End
  10. end if
  11. %>
  12. <%
  13. dim id
  14. id=request.QueryString("id")
  15. If NOT IsEmpty (request("SaveEditSubmit")) then
  16. dim productdate,discount
  17. discount=round(request("price2")/request("price1"),2)
  18. if request("productdateyear")<>"" then
  19. productdate=trim(request("productdateyear"))&"年"&trim(request("productdatemonth"))&"月"
  20. else
  21. productdate=""
  22. end if
  23. set rs=server.CreateObject("adodb.recordset")
  24. rs.Open "select * from product where id="&id,conn,1,3
  25. rs("productdate")=productdate 
  26. rs("discount")=discount 
  27. rs("name")=trim(request("name")) 
  28. rs("format")=request("format")
  29. if request("pagenum")<>"" then
  30. rs("pagenum")=int(request("pagenum"))
  31. else
  32. rs("pagenum")=0
  33. end if
  34. if request("printed")<>"" then
  35. rs("printed")=int(request("printed"))
  36. else
  37. rs("printed")=0
  38. end if
  39. rs("author")=trim(request("author"))
  40. rs("mark")=trim(request("mark"))
  41. rs("introduce")=trim(request("introduce")) 
  42. rs("price1")=trim(request("price1"))  
  43. rs("price2")=trim(request("price2"))  
  44. rs("vipprice")=trim(request("vipprice"))  
  45. rs("pic")=trim(request("pic")) 
  46. rs("categoryid")=int(request("categoryid"))
  47. rs("sortsid")=int(request("sortsid")) 
  48. rs("score")=request("score") 
  49. rs("type")=trim(request("type"))
  50. if request("detail")<>"" then
  51. rs("detail")=htmlencode2(request("detail"))
  52. end if
  53. if request("content")<>"" then
  54. rs("content")=htmlencode2(request("content"))
  55. end if
  56. if request("detail")<>"" then
  57. rs("desc")=htmlencode2(strvalue(request("detail") ,100))
  58. end if
  59. if request("recommend")=1 then  
  60. rs("recommend")=1
  61. else
  62. rs("recommend")=0
  63. end if
  64. rs.Update
  65. rs.Close
  66. set rs=nothing
  67. call MsgBox("修改成功!","GoUrl","mpro.asp")
  68. end if
  69. %>
  70. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  71. <html>
  72. <head>
  73. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  74. <title>406网络书店</title>
  75. <link href="../style.css" rel="stylesheet" type="text/css">
  76. </head>
  77. <body>
  78. <!--#include file="head.htm"-->
  79. <table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
  80.   <tr>
  81.     <td width="219" align="left" valign="top"><br>
  82.       <!--#include file="menu.htm"-->
  83.         <br></td><td width="561" align="left" valign="top">      <table border="0" cellpadding="0" cellspacing="0">
  84.         <tr>
  85.           <td><img src="../images/w.gif" width="18" height="18"></td>
  86.           <td style="color:#415373">编辑商品属性</td>
  87.         </tr>
  88.       </table>      <%
  89. dim count
  90. set rs=server.createobject("adodb.recordset")
  91. rs.open "select * from sorts order by sortsorder ",conn,1,1
  92. %>      <script language = "JavaScript">
  93. var onecount;
  94. onecount=0;
  95. subcat = new Array();
  96. <%
  97.    count = 0
  98.    do while not rs.eof 
  99. %>
  100. subcat[<%=count%>] = new Array("<%= trim(rs("sorts"))%>","<%= rs("categoryid")%>","<%= rs("sortsid")%>");
  101. <%
  102.         count = count + 1
  103.         rs.movenext
  104.         loop
  105.         rs.close
  106. %>
  107. onecount=<%=count%>;
  108. function changelocation(locationid)
  109.     {
  110.     document.myform.sortsid.length = 0; 
  111.     var locationid=locationid;
  112.     var i;
  113.     for (i=0;i < onecount; i++)
  114.         {
  115.             if (subcat[i][1] == locationid)
  116.             { 
  117.              document.myform.sortsid.options[document.myform.sortsid.length] = new Option(subcat[i][0], subcat[i][2]);
  118.             }        
  119.         }
  120.         
  121.     }    
  122.       </script>      <br>      <form action="" method="post" name="myform" id="myform">
  123.         <table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
  124.           <tr>
  125.             <td width="21%" align="right"><span class="redfont">*</span>选择分类:</td>
  126.             <td colspan="2">
  127.               <%
  128. rs.open "select * from category order by categoryorder",conn,1,1
  129. if rs.eof and rs.bof then
  130. response.write "请先添加栏目。"
  131. else
  132. dim rs1
  133. set rs1=server.CreateObject("adodb.recordset")
  134. rs1.open "select * from product where id="&id,conn,1,1
  135. %>
  136.               <select name="categoryid" size="1" id="categoryid" onChange="changelocation(document.myform.categoryid.options[document.myform.categoryid.selectedIndex].value)">
  137.                 <option selected value="<%=rs("categoryid")%>"><%=trim(rs("category"))%></option>
  138.                 <%      dim selclass
  139.          selclass=rs1("categoryid")
  140.         rs.movenext
  141.         do while not rs.eof
  142.   response.write  "<option value="&rs("categoryid")
  143.   if rs1("categoryid")=rs("categoryid") then response.write " selected "
  144.   response.write ">"&trim(rs("category"))&"</option>"    
  145.         rs.movenext
  146.         loop
  147. end if
  148.         rs.close
  149. %>
  150.               </select>
  151.       小类:
  152.       <select name="sortsid">
  153.         <%rs.open "select * from sorts where categoryid="&selclass ,conn,1,1
  154. if not(rs.eof and rs.bof) then
  155. %>
  156.         <option selected value="<%=rs("sortsid")%>"><%=rs("sorts")%></option>
  157.         <% rs.movenext
  158. do while not rs.eof
  159.   response.write  "<option value="&rs("sortsid")
  160.   if rs1("sortsid")=rs("sortsid") then response.write " selected "
  161.   response.write ">"&trim(rs("sorts"))&"</option>"  
  162. rs.movenext
  163. loop
  164. end if
  165.         rs.close
  166.         set rs = nothing
  167.         
  168. %>
  169.       </select>
  170.       <font color="#FF0000">&nbsp; </font></td>
  171.           </tr>
  172.           <tr>
  173.             <td align="right"><span class="redfont">*</span>书名: </td>
  174.             <td colspan="2"><input name="name" type="text" id="name2" size="30" value="<%=trim(rs1("name"))%>"></td>
  175.           </tr>
  176.           <tr>
  177.             <td align="right"><span class="redfont">*</span>作者:</td>
  178.             <td colspan="2"><input name="author" type="text" id="mark" size="30" value="<%=trim(rs1("author"))%>"></td>
  179.           </tr>
  180.           <tr>
  181.             <td align="right"><span class="redfont">*</span>出 版 社:</td>
  182.             <td colspan="2"><input name="mark" type="text" id="mark2" size="30" value="<%=trim(rs1("mark"))%>"></td>
  183.           </tr>
  184.           <tr>
  185.             <td align="right">装帧: </td>
  186.             <td colspan="2"><input name="introduce" type="text" id="introduce2" size="30" value="<%=trim(rs1("introduce"))%>"></td>
  187.           </tr>
  188.           <tr>
  189.             <td height="20" align="right"><span class="redfont">*</span>出版日期:</td>
  190.             <td colspan="2"><select name="productdateyear" id="select">
  191.                 <%dim i
  192. for i=1996 to 2006 
  193.   response.write  "<option value="&i
  194.   if int(left(rs1("productdate"),4))=i then response.write " selected "
  195.   response.write ">"&i&"</option>" 
  196. next
  197. %>
  198.               </select>
  199.       年
  200.       <select name="productdatemonth" id="select2">
  201.         <%dim b
  202. b=array("01","02","03","04","05","06","07","08","09","10","11","12")
  203. for i=1 to 12
  204. response.write  "<option value="&trim(b(i-1))
  205.   if  left(right(rs1("productdate"),3),2)=trim(b(i-1)) then response.write " selected "
  206.   response.write ">"&i&"</option>"
  207. next%>
  208.       </select>
  209.       月</td>
  210.           </tr>
  211.           <tr>
  212.             <td align="right" valign="top"><span class="redfont">*</span>价格: </td>
  213.             <td colspan="2">市场价:
  214.                 <input name="price1" type="text" id="price12" size="5" onkeypress = "return regInput(this, /^d*.?d{0,2}$/, String.fromCharCode(event.keyCode))" 
  215. onpaste = "return regInput(this, /^d*.?d{0,2}$/, window.clipboardData.getData('Text'))"
  216. ondrop = "return regInput(this, /^d*.?d{0,2}$/, event.dataTransfer.getData('Text'))" value="<%=rs1("price1")%>">
  217.       元,普通会员价
  218.       <input name="price2" type="text" id="price22" size="5" onkeypress = "return regInput(this, /^d*.?d{0,2}$/, String.fromCharCode(event.keyCode))" 
  219. onpaste = "return regInput(this, /^d*.?d{0,2}$/, window.clipboardData.getData('Text'))"
  220. ondrop = "return regInput(this, /^d*.?d{0,2}$/, event.dataTransfer.getData('Text'))" value="<%=rs1("price2")%>">
  221.       元, VIP会员价:
  222.       <input name="vipprice" type="text" id="vipprice2" size="5" onkeypress = "return regInput(this, /^d*.?d{0,2}$/, String.fromCharCode(event.keyCode))" 
  223. onpaste = "return regInput(this, /^d*.?d{0,2}$/, window.clipboardData.getData('Text'))"
  224. ondrop = "return regInput(this, /^d*.?d{0,2}$/, event.dataTransfer.getData('Text'))" value="<%=rs1("vipprice")%>">
  225.       元<br>
  226.       赠送积分:
  227.       <INPUT NAME="score" VALUE="<%=trim(rs1("score"))%>" SIZE="4" TYPE="text" ONKEYPRESS = "return regInput(this, /^[0-9]*$/, String.fromCharCode(event.keyCode))"
  228. ONPASTE = "return regInput(this, /^[0-9]*$/, window.clipboardData.getData('Text'))"
  229. ONDROP = "return regInput(this, /^[0-9]*$/, event.dataTransfer.getData('Text'))">
  230.       分</td>
  231.           </tr>
  232.           
  233.           <tr>
  234.             <td height="19" align="right">开本:</td>
  235.             <td colspan="2"><input name="format" type="text" id="grade2" size="10" value="<%=trim(rs1("format"))%>"></td>
  236.           </tr>
  237.           <tr>
  238.             <td height="19" align="right">版次:</td>
  239.             <td colspan="2"><input name="printed" type="text" id="printed" value="<%=trim(rs1("printed"))%>" size="10"></td>
  240.           </tr>
  241.           <tr>
  242.             <td height="19" align="right">页数: </td>
  243.             <td colspan="2"><input name="pagenum" type="text" id="pagenum" value="<%=trim(rs1("pagenum"))%>" size="10"></td>
  244.           </tr>
  245.           <tr>
  246.             <td height="19" align="right"><span class="redfont">*</span>ISBN:</td>
  247.             <td colspan="2"><input name="type" type="text" id="type" value="<%=trim(rs1("type"))%>" size="30">
  248.             </td>
  249.           </tr>
  250.           <tr>
  251.             <td align="right"><span class="redfont">*</span>商品图片:</td>
  252.             <td colspan="2"><input name="pic" type="text" id="pic2" size="30" value="<%=trim(rs1("pic"))%>">
  253. &nbsp;&nbsp;
  254.       <input type="button" name="Submit2" value="上 传" onClick="javascript:window.open('upfile.asp','','width=580,height=160,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=no');return false;"></td>
  255.           </tr>
  256.           <tr>
  257.             <td align="right" valign="top">详细说明: </td>
  258.             <td colspan="2"><textarea name="detail" cols="46" rows="8" id="textarea"><% if rs1("detail")<>"" then response.write HTMLDecode(trim(rs1("detail")))%></textarea></td>
  259.           </tr>
  260.           <tr>
  261.             <td align="right" valign="top">目录:</td>
  262.             <td colspan="2"><textarea name="content" cols="46" rows="8" id="textarea2"><%if rs1("content")<>"" then response.write HTMLDecode(trim(rs1("content")))%></textarea></td>
  263.           </tr>
  264.           <tr>
  265.             <td height="32" colspan="3"><div align="center"> </div>              <div align="center">
  266.                 <input name="recommend" type="checkbox" id="recommend2" value="1" <%if rs1("recommend")=1 then response.write "checked"%>>
  267.         推荐此商品
  268.         <input type="submit" name="SaveEditSubmit" value="修改" onClick="return check();">
  269.               <input name="id" type="hidden" id="id" value="<%=id%>">
  270.             </div></td>
  271.           </tr>
  272.         </table>
  273.       </form>      <%rs1.close
  274. set rs1=nothing
  275. conn.close
  276. set conn=nothing%>      <script language="JavaScript">
  277. <!--
  278. function checkpro()
  279. {
  280.     if(checkspace(document.myform.name.value)) {
  281. document.myform.name.focus();
  282.     alert("请输入书名!");
  283. return false;
  284.   }
  285. if(checkspace(document.myform.author.value)) {
  286. document.myform.author.focus();
  287.     alert("请输入作者!");
  288. return false;
  289.   }
  290. if(checkspace(document.myform.mark.value)) {
  291. document.myform.mark.focus();
  292.     alert("请输入出版社!");
  293. return false;
  294.   }
  295. if(checkspace(document.myform.type.value)) {
  296. document.myform.type.focus();
  297.     alert("请输入ISBN!");
  298. return false;
  299.   }
  300.     if(checkspace(document.myform.price1.value)||document.myform.price1.value==0) {
  301. document.myform.price1.focus();
  302.     alert("请输入市场价!");
  303. return false;
  304.   }
  305.     if(checkspace(document.myform.price2.value)||document.myform.price2.value==0) {
  306. document.myform.price2.focus();
  307.     alert("请输入会员价!");
  308. return false;
  309.   }
  310.     if(checkspace(document.myform.vipprice.value)||document.myform.vipprice.value==0) {
  311. document.myform.vipprice.focus();
  312.     alert("请输入VIP价!");
  313. return false;
  314.   }
  315.      if(checkspace(document.myform.price1.value)) {
  316. document.myform.price1.focus();
  317.     alert("请输入商品市场价格!");
  318. return false;
  319.   }
  320.      if(checkspace(document.myform.price2.value)) {
  321. document.myform.price2.focus();
  322.     alert("请输入商品会员价格!");
  323. return false;
  324.   }
  325.       if(checkspace(document.myform.vipprice.value)) {
  326. document.myform.vipprice.focus();
  327.     alert("请输入VIP月会员商品价格!");
  328. return false;
  329.   }
  330.  
  331. }
  332. function checkspace(checkstr) {
  333.   var str = '';
  334.   for(i = 0; i < checkstr.length; i++) {
  335.     str = str + ' ';
  336.   }
  337.   return (str == checkstr);
  338. }
  339. function regInput(obj, reg, inputStr)
  340. {
  341. var docSel = document.selection.createRange()
  342. if (docSel.parentElement().tagName != "INPUT") return false
  343. oSel = docSel.duplicate()
  344. oSel.text = ""
  345. var srcRange = obj.createTextRange()
  346. oSel.setEndPoint("StartToStart", srcRange)
  347. var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
  348. return reg.test(str)
  349. }
  350. //-->
  351.                           
  352.       </script>      <br>      <br>
  353.       </td>
  354.   </tr>
  355. </table>
  356. <!--#include file="foot.htm"-->
  357. </body>
  358. </html>