addbook.asp

来自「创建和运行动态、交互的Web服务器应用程序」· ASP 代码 · 共 333 行 · 第 1/2 页

ASP
333
字号
<!--#include file="conn.asp"-->
<%dim upictemp
      upictemp=request.QueryString("pictemp")%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../images/css2.css" rel="stylesheet" type="text/css">

<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)
	}
        
        function showpub()
        {
                document.all.add_publish.style.display=""
        }

</script>

<SCRIPT LANGUAGE="JavaScript">
<!--
function check()
{
    if(document.myform.anclassid.value==0) {
	document.myform.anclassid.focus();
    alert("请选择图书分类!");
	return false;
  }  
    if(checkspace(document.myform.bookname.value)) {
	document.myform.bookname.focus();
    alert("请输入图书名称!");
	return false;
  }  
    if(checkspace(document.myform.isbn.value)) {
	document.myform.isbn.focus();
    alert("请输入书号!");
	return false;
  }
    if(checkspace(document.myform.bookchuban.value)) {
	document.myform.bookchuban.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.banci.value)) {
	document.myform.banci.focus();
    alert("请输入版次!");
	return false;
  }
    if(checkspace(document.myform.yeshu.value)) {
	document.myform.yeshu.focus();
    alert("请输入页数!");
	return false;
  }

}

function checkspace(checkstr) 
{
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}

function checkImage(sId)
{
  if(( document.all[sId].value.indexOf(".gif") == -1) && (document.all[sId].value.indexOf(".jpg") == -1)) {
    alert("请选择gif或jpg的图象文件");
    event.returnValue = false;
    }
}

function showedit()
  {
 if(document.all.bkpicadd.checked==true)
      {
      document.all.add_bookpicup.style.display="";
      document.all.add_bookpicok.style.display="none";
		}
 else {
      document.all.add_bookpicup.style.display="none";
      document.all.add_bookpicok.style.display="";
		}
  }

<%dim count
set rs=server.createobject("adodb.recordset")
    rs.open "select * from shop_Nclass order by Nclassidorder ",conn,1,1%>
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]);
            }        
        }
        
    } 

function changepub(pubid)
    {
    var pubid=pubid;
    document.myform.bookchuban.value=pubid;
    document.all.add_publish.style.display="none";
    } 

//-->   
</script>

</head>
<body>

<table width="90%"  border="0" height=450 cellpadding="0" cellspacing="0">
  <tr><td bgcolor="#ece9d8"><br>
      <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr><td>
            <table width=154  border="0"  cellpadding="0" cellspacing="0">
               <tr valign=bottom>
                  <td background=images/lose_img.gif width=77 height=26><P style='PADDING-LEFT: 7px'><div align="center"><a href=managebook.asp><font color=#000000>图书管理</font></a></div></td>
                  <td background=images/get_img.gif  width=77 height=26><P style='PADDING-LEFT: 7px'><div align="center"><font color=#ffffff>增加图书</font></div></td>
               </tr>
          </table>
        </tr>
      </table>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?