<!--#include file="conn.asp"-->
<%if session("admin")="" then
response.Write "<script language='javascript'>alert('网络超时或您还没有登陆！');history.go(-1);</script>"
response.End
end if
dim bookid
bookid=request.QueryString("id")
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../images/css.css" rel="stylesheet" type="text/css">
<style>
td{font-size:9pt;line-height:120%;color:#353535} 
body{font-size:9pt;line-height:120%} 

a:link          { color: #000000; text-decoration: none }
a:visited       { color: #000000; text-decoration: none }
a:active        { color: #000000; text-decoration: none }
a:hover         { color: #336699; text-decoration: none; position: relative; right: 0px; top: 1px }
</style>
</head>
<%dim count
set rs=server.createobject("adodb.recordset")
rs.open "select * from shop_Nclass 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 bgcolor="#799AE1">
<table width="80%" border="1" cellspacing="0" cellpadding="1" bordercolor="#6699FF" align="center">
  <tr> 
    <td> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td background="../images/back_3.gif" rowspan="2"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="12v">
              <tr> 
                <td class="12v" > 
                  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="AutoNumber3" height="0" width="100%">
                    <tr> 
                      <td> 
                        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#6B8FC8">
                          <tr> 
                            <td bgcolor="#FFFFFF" height="20"> 
                              <div align="center"><font color="#000000">修改商品</font></div>
                            </td>
                          </tr>
                          <tr> 
                            <form name="myform" method="post" action="saveaddbook.asp?action=edit&id=<%=bookid%>">
                              <td height="126" bgcolor="#E8F1FF"> 
                                <table width="88%" border="0" align="center" cellpadding="2" cellspacing="0">
                                  <tr> 
                                    <td width="16%"> 
                                      <div align="center">选择分类：</div>
                                    </td>
                                    <td colspan="2"> 
                                      <%
        rs.open "select * from shop_anclass 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)">
                                        <option selected value="<%=rs("anclassid")%>"><%=trim(rs("anclass"))%></option>
                                        <%      dim selclass
         selclass=rs("anclassid")
        rs.movenext
        do while not rs.eof
%>
                                        <option value="<%=rs("anclassid")%>"><%=trim(rs("anclass"))%></option>
                                        <%
        rs.movenext
        loop
	end if
        rs.close
%>
                                      </select>
                                      小类： 
                                      <select name="Nclassid">
                                        <%rs.open "select * from shop_Nclass where anclassid="&selclass ,conn,1,1
if not(rs.eof and rs.bof) then
%>
                                        <option selected value="<%=rs("NclassID")%>"><%=rs("Nclass")%></option>
                                        <% rs.movenext
do while not rs.eof%>
                                        <option value="<%=rs("NclassID")%>"><%=rs("Nclass")%></option>
                                        <% rs.movenext
loop
end if
        rs.close
        set rs = nothing
        
%>
                                      </select>
                                      <%dim rs1
set rs1=server.CreateObject("adodb.recordset")
rs1.open "select * from shop_books where bookid="&bookid,conn,1,1
%>
                                      <font color="#FF0000"> </font></td>
                                  </tr>
                                  <tr> 
                                    <td> 
                                      <div align="center"><font color="#FF0000"><%=trim(rs1("mch"))%></font> 
                                      </div>
                                    </td>
                                    <td colspan="2"> 
                                      <input name="bookname" type="text" id="bookname" size="30" value="<%=trim(rs1("bookname"))%>">
                                    </td>
                                  </tr>
                                  <tr> 
                                    <td> 
                                      <div align="center"><font color="#FF0000"><%=trim(rs1("pp"))%></font></div>
                                    </td>
                                    <td colspan="2"> 
                                      <input name="bookname2" type="text" id="bookname" size="30" value="<%=trim(rs1("pingpai"))%>">
                                    </td>
                                  </tr>
                                  <tr> 
                                    <td> 
                                      <div align="center"><font color="#FF0000"><%=trim(rs1("qch"))%></font> 
                                      </div>
                                    </td>
                                    <td colspan="2"> 
                                      <input name="bookzz" type="text" id="bookzz" size="30" value="<%=trim(rs1("bookzz"))%>">
                                    </td>
                                  </tr>
                                  <tr> 
                                    <td> 
                                      <div align="center"><font color="#FF0000"><%=trim(rs1("jj"))%></font> 
                                      </div>
                                    </td>
                                    <td colspan="2"> 
                                      <input name="bookchuban" type="text" id="bookchuban" size="30" value="<%=trim(rs1("bookchuban"))%>">
                                    </td>
                                  </tr>
                                  <tr> 
                                    <td height="20"> 
                                      <div align="center"><font color="#FF0000"><%=trim(rs1("rq"))%></font> 
                                      </div>
                                    </td>
                                    <td colspan="2"> 
                                      <select name="bookdateyear" id="bookdateyear">
                                        <%dim i
				for i=1996 to 2006 
				response.write "<option value="&i&">"&i&"</option>"
				next
			%>
                                      </select>
                                      年 
                                      <select name="bookdatemonth" id="bookdatemonth">
                                        <%for i=1 to 12
				response.write "<option value="&i&">"&i&"</option>"
				next%>
                                      </select>
                                      月 <font color="#FF0000">原日期：<%=trim(rs1("bookdate"))%></font></td>
                                  </tr>
                                  <tr> 
                                    <td valign="top"> 
                                      <div align="center"><font color="#FF0000">商品价格：</font></div>
                                    </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")%>">
                                      元 </td>
                                  </tr>
                                  <tr> 
                                    <td> 
                                      <div align="center"><font color="#FF0000"><%=trim(rs1("zl"))%></font> 
                                      </div>
                                    </td>
                                    <td colspan="2">开本： 
                                      <input name="kaiben" type="text" id="kaiben"  size="4" value="<%=trim(rs1("kaiben"))%>">
                                      ，版次： 
                                      <input name="banci"  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'))" value="<%=cstr(rs1("banci"))%>">
                                      次，页数： 
                                      <input name="yeshu" type="text" id="yeshu" size="4" 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'))" value="<%=cstr(rs1("yeshu"))%>">
                                      页</td>
                                  </tr>
                                  <tr> 
                                    <td> 
                                      <div align="center"><font color="#FF0000"><%=trim(rs1("xx"))%></font> 
                                      </div>
                                    </td>
                                    <td colspan="2"> 
                                      <select name="zhuang" id="zhuang">
                                        <option value="简装">简装</option>
                                        <option value="精装">精装</option>
                                        <option value="特殊">特殊</option>
                                      </select>
                                      <font color="#FF0000">原：<%=trim(rs1("zhuang"))%></font></td>
                                  </tr>
                                  <tr> 
                                    <td> 
                                      <div align="center"><font color="#FF0000"><%=trim(rs1("isbn1"))%></font> 
                                      </div>
                                    </td>
                                    <td colspan="2"> 
                                      <input name="isbn" type="text" id="isbn" size="30" value="<%=trim(rs1("isbn"))%>">
                                    </td>
                                  </tr>
                                  <tr> 
                                    <td height="18"> 
                                      <div align="center"><font color="#FF0000"><%=trim(rs1("tp"))%></font> 
                                      </div>
                                    </td>
                                    <td height="18" colspan="2"> 
                                      <input name="bookpic" type="text" id="bookpic" size="30" value="<%=trim(rs1("bookpic"))%>">
                                      &nbsp;&nbsp; 
                                      <input type="button" name="Submit2" value="上 传" onClick="javascript:window.open('upfile.htm','','width=580,height=160,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=no');return false;">
                                    </td>
                                  </tr>
                                  <tr> 
                                    <td valign="top"> 
                                      <div align="center"><font color="#FF0000"><%=trim(rs1("nr"))%></font> 
                                      </div>
                                    </td>
                                    <td colspan="2"> 
                                      <textarea name="bookcontent" cols="46" rows="8" id="bookcontent"><%=trim(rs1("bookcontent"))%></textarea>
                                    </td>
                                  </tr>
                                  <tr> 
                                    <td valign="top"> 
                                      <div align="center"><font color="#FF0000"><%=trim(rs1("ml"))%></font> 
                                      </div>
                                    </td>
                                    <td colspan="2"> 
                                      <textarea name="bookmulu" cols="46" rows="8" id="bookmulu"><%=trim(rs1("bookmulu"))%></textarea>
                                    </td>
                                  </tr>
                                  <tr> 
                                    <td height="32"> 
                                      <div align="center"> </div>
                                    </td>
                                    <td width="32%" height="32"> 
                                      <div align="center"> 
                                        <input type="submit" name="Submit" value="修 改" onClick="return check();">
                                      </div>
                                    </td>
                                    <td width="52%"> 
                                      <input name="bestbook" type="checkbox" id="bestbook" value="1">
                                      推荐此商品</td>
                                  </tr>
                                </table>
                              </td>
                            </form>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<%rs1.close
set rs1=nothing
conn.close
set conn=nothing%>
<br>
<!--#include file="copyright.asp"-->
</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;
  }
 
}
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>