静态页面怎么加搜索功能

核心提示当前页面只显示一个按钮和一个文本框新开一个页面,专门用来显示结果以下内容为在网上找到的搜索代码<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%><!--#i nclude file="manage/inc/con

当前页面只显示一个按钮和一个文本框

新开一个页面,专门用来显示结果

以下内容为在网上找到的搜索代码

<%@LANGUAGE="VBscript" CODEPAGE="936"%>

<!--#i nclude file="manage/inc/config.asp"-->

<!--#i nclude file="inc/conn.asp"-->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>爱T发明书店</title>

<link href="/blog/style.css" rel="stylesheet" type="text/css">

</style>

<!-- European format dd-mm-yyyy -->

<script language="Javascript" src="/blog/calendar.js"></script>

</head>

<body>

<!--#i nclude file="head.htm"-->

<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>

<td width="219" align="left" valign="top"><!--#i nclude file="left.asp"--></td>

<td width="561" align="left" valign="top">

<br> <script language=javascript>

var whitespace = " tnr";

function IsWhitespace (s)

{

var i;

if (IsEmpty(s)) return true;

for (i = 0; i < s.length; i++)

{

var c = s.charAt(i);

if (whitespace.indexOf(c) == -1) return false;

}

return true;

}

function IsEmpty(s)

{

return ((s == null) || (s.length == 0))

}

function IsDate(fDate)

{

var arrDaysInMonth=new Array(12);

arrDaysInMonth[1]=31;

arrDaysInMonth[2]=29;

arrDaysInMonth[3]=31;

arrDaysInMonth[4]=30;

arrDaysInMonth[5]=31;

arrDaysInMonth[6]=30;

arrDaysInMonth[7]=31;

arrDaysInMonth[8]=31;

arrDaysInMonth[9]=30;

arrDaysInMonth[10]=31;

arrDaysInMonth[11]=30;

arrDaysInMonth[12]=31;

if (IsEmpty(fDate))

return true

var NameList=fDate.split("-");

if (NameList.length!=3)

return false

if (!(IsYear(NameList[0]) && IsMonth(NameList[1]) && IsDay(NameList[2])) )

return false

if ( NameList[1]>arrDaysInMonth[NameList[1]] )

return false

if ( (NameList[1]==2) && (NameList[2]>DaysInFebruary(NameList[0]) ) )

return false

return true

}

function search()

{

var name = document.forms['frmdata'].elements['name'].value;

var author = document.forms['frmdata'].elements['author'].value;

var manufacturer = document.forms['frmdata'].elements['manufacturer'].value;

var smallprice = document.forms['frmdata'].elements['smallprice'].value;

var largeprice = document.forms['frmdata'].elements['largeprice'].value;

var enabledate = document.forms['frmdata'].elements['enabledate'].value;

var expiredate = document.forms['frmdata'].elements['expiredate'].value;

if (!IsWhitespace(enabledate))

{

if (!IsDate(enabledate))

{

alert("出版日期 开始日期格式错误!");

return false;

}

}

if (!IsWhitespace(expiredate))

{

if (!IsDate(expiredate))

{

alert("出版日期 结束日期格式错误!");

return false;

}

}

var allNotEmpty = (!IsWhitespace(name)) ||

(!IsWhitespace(author)) ||

(!IsWhitespace(manufacturer)) ||

(!IsWhitespace(smallprice)) ||

(!IsWhitespace(largeprice))||

(!IsWhitespace(enabledate)) ||

(!IsWhitespace(expiredate));

if (!allNotEmpty)

{

alert("必需输入一个搜索条件");

return false;

}

if (!IsWhitespace(smallprice))

{

if (!IsPlusNumeric(smallprice))

{

alert("价格数据不合法");

return false;

}

}

if (!IsWhitespace(largeprice))

{

if (!IsPlusNumeric(largeprice))

{

alert("价格数据不合法");

return false;

}

}

if ((!IsWhitespace(enabledate)) && (!IsWhitespace(expiredate)))

{

if (enabledate>expiredate)

{

alert("出版日期范围错误");

return false;

}

}

if ((!IsWhitespace(smallprice)) && (!IsWhitespace(largeprice)))

{

if (parseFloat(smallprice)>parseFloat(largeprice))

{

alert("价格范围错误");

return false;

}

}

}

</script> <br> <table cellpadding="0" cellspacing="0" border="0">

<tr>

<td><img src="/blog/images/w.gif"></td>

<td >搜索图书</td>

</tr>

</table> <br> <FORM name=frmdata method=get action="rsearch.asp">

<TABLE cellSpacing=10 cellPadding=0 width="100%" border=0>

<TBODY>

<TR>

<TD align=right width="31%" height=30>商品名称:</TD>

<TD width="69%"><INPUT name=name >

</TD>

</TR>

<TR>

<TD align=right width="31%" height=30>作者名称:</TD>

<TD width="69%"><INPUT name=author >

</TD>

</TR>

<TR>

<TD align=right width="31%" height=30>出版社:</TD>

<TD width="69%"><INPUT name=manufacturer >

</TD>

</TR>

<TR>

<TD align=right width="31%" height=28>出版时间:</TD>

<TD vAlign=center width="69%"><INPUT name=enabledate size=12>

<a

href="javascript:cal1.popup();"><img height=16 alt=点击选择日期

src="/blog/images/cal.gif" width=16 border=0></a> 至

<INPUT name=expiredate size=12>

<a

href="javascript:cal2.popup();"><img height=16 alt=点击选择日期

src="/blog/images/cal.gif" width=16 border=0></a> <script language=Javascript>

var cal1 = new calendar1(document.forms['frmdata'].elements['enabledate']);

cal1.year_scroll = true;

cal1.time_comp = false;

var cal2 = new calendar1(document.forms['frmdata'].elements['expiredate']);

cal2.year_scroll = true;

cal2.time_comp = false;

</script></TD>

</TR>

<TR>

<TD align=right width="31%" height=30>价格范围:</TD>

<TD width="69%"> <input name="smallprice" type="text" id="smallprice" size="5" >

<input name="largeprice" type="text" id="largeprice"

size="5" >

</TD>

</TR>

<TR>

<TD align=right height=30>分类:</TD>

<TD><select name=code>

<option value="" selected>所有图书</option>

<%

set rs=server.CreateObject("adodb.recordset")

rs.open "select * from category",conn,1,1

do while not rs.eof

%>

<option value="<%=rs("categoryid")%>" ><%=rs("category")%></option>

<%

rs.movenext

loop

rs.close

set rs=nothing

%>

</select></TD>

</TR>

<TR>

<TD align=right height=30>排序字段:</TD>

<TD><input name="OrderField" type="radio" value="adddate" checked>

添加日期 <input type="radio" name="OrderField" value="productdate">

出版日期

<input type="radio" name="OrderField" value="price2">

价钱(会员价)

<br>

<br> <input type="radio" name="OrderField" value="vipprice">

价钱(VIP)

<input type="radio" name="OrderField" value="pagenum">

页数 <input type="radio" name="OrderField" value="discount">

折扣</TD>

</TR>

<TR>

<TD align=right width="31%" height=30>排序方式:</TD>

<TD width="69%"><input type="radio" name="Order" value="ASC">

升序

<input name="Order" type="radio" value="DESC" checked>

降序</TD>

</TR>

<TR align=center>

<TD height=40 colSpan=2><INPUT type=submit value=开始搜索 name=Submit2 onClick="return search()"> </TD>

</TR>

</TABLE>

</FORM></td>

</tr>

</table>

<!--#i nclude file="foot.htm"-->

</body>

</html>

sa

3

服部全藏

桃源村

格陵兰岛

喜多村英梨

幻想乡

新房昭之

BL-10

心脏病

佐佐木优太

BONES

 
友情链接
鄂ICP备19019357号-22