我想制作一个搜索提交页和一个结果返馈页,我把MX中的程序贴出来,请大家帮忙看看问题出在哪里,问题是我的搜索页无法转到结果页。
搜索提交页程序
---------------------------------------------------------------------------------------
<%@LANGUAGE="javascript" CODEPAGE="936"%>
<%
var rs_chanping = Server.CreateObject("ADODB.Recordset");
rs_chanping.ActiveConnection = MM_products_STRING;
rs_chanping.Source = "SELECT * FROM 产品";
rs_chanping.CursorType = 0;
rs_chanping.CursorLocation = 2;
rs_chanping.LockType = 1;
rs_chanping.Open();
var rs_chanping_numRows = 0;
%>
<%
var HLooper1__numRows = 4;
var HLooper1__index = 0;
rs_chanping_numRows += HLooper1__numRows;
%>
<%
// *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
// set the record count
var rs_chanping_total = rs_chanping.RecordCount;
// set the number of rows displayed on this page
if (rs_chanping_numRows < 0) { // if repeat region set to all records
rs_chanping_numRows = rs_chanping_total;
} else if (rs_chanping_numRows == 0) { // if no repeat regions
rs_chanping_numRows = 1;
}
// set the first and last displayed record
var rs_chanping_first = 1;
var rs_chanping_last = rs_chanping_first + rs_chanping_numRows - 1;
// if we have the correct record count, check the other stats
if (rs_chanping_total != -1) {
rs_chanping_numRows = Math.min(rs_chanping_numRows, rs_chanping_total);
rs_chanping_first = Math.min(rs_chanping_first, rs_chanping_total);
rs_chanping_last = Math.min(rs_chanping_last, rs_chanping_total);
}
%>
<%
// *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
// set the record count
var rs_chanping_total = rs_chanping.RecordCount;
// set the number of rows displayed on this page
if (rs_chanping_numRows < 0) { // if repeat region set to all records
rs_chanping_numRows = rs_chanping_total;
} else if (rs_chanping_numRows == 0) { // if no repeat regions
rs_chanping_numRows = 1;
}
// set the first and last displayed record
var rs_chanping_first = 1;
var rs_chanping_last = rs_chanping_first + rs_chanping_numRows - 1;
// if we have the correct record count, check the other stats
if (rs_chanping_total != -1) {
rs_chanping_numRows = Math.min(rs_chanping_numRows, rs_chanping_total);
rs_chanping_first = Math.min(rs_chanping_first, rs_chanping_total);
rs_chanping_last = Math.min(rs_chanping_last, rs_chanping_total);
}
%>
<%
// *** Recordset Stats: if we don't know the record count, manually count them
if (rs_chanping_total == -1) {
// count the total records by iterating through the recordset
for (rs_chanping_total=0; !rs_chanping.EOF; rs_chanping.MoveNext()) {
rs_chanping_total++;
}
// reset the cursor to the beginning
if (rs_chanping.CursorType > 0) {
if (!rs_chanping.BOF) rs_chanping.MoveFirst();
} else {
rs_chanping.Requery();
}
// set the number of rows displayed on this page
if (rs_chanping_numRows < 0 || rs_chanping_numRows > rs_chanping_total) {
rs_chanping_numRows = rs_chanping_total;
}
// set the first and last displayed record
rs_chanping_last = Math.min(rs_chanping_first + rs_chanping_numRows - 1, rs_chanping_total);
rs_chanping_first = Math.min(rs_chanping_first, rs_chanping_total);
}
%>
<% var MM_paramName = ""; %>
<%
// *** Move To Record and Go To Record: declare variables
var MM_rs = rs_chanping;
var MM_rsCount = rs_chanping_total;
var MM_size = rs_chanping_numRows;
var MM_uniqueCol = "";
MM_paramName = "";
var MM_offset = 0;
var MM_atTotal = false;
var MM_paramIsDefined = (MM_paramName != "" && String(Request(MM_paramName)) != "undefined");
%>
<%
// *** Move To Record: handle 'index' or 'offset' parameter
if (!MM_paramIsDefined && MM_rsCount != 0) {
// use index parameter if defined, otherwise use offset parameter
r = String(Request("index"));
if (r == "undefined") r = String(Request("offset"));
if (r && r != "undefined") MM_offset = parseInt(r);
// if we have a record count, check if we are past the end of the recordset
if (MM_rsCount != -1) {
if (MM_offset >= MM_rsCount || MM_offset == -1) { // past end or move last
if ((MM_rsCount % MM_size) != 0) { // last page not a full repeat region
MM_offset = MM_rsCount - (MM_rsCount % MM_size);
} else {
MM_offset = MM_rsCount - MM_size;
}
}
}
// move the cursor to the selected record
for (var i=0; !MM_rs.EOF && (i < MM_offset || MM_offset == -1); i++) {
MM_rs.MoveNext();
}
if (MM_rs.EOF) MM_offset = i; // set MM_offset to the last possible record
}
%>
<%
// *** Move To Record: if we dont know the record count, check the display range
if (MM_rsCount == -1) {
// walk to the end of the display range for this page
for (var i=MM_offset; !MM_rs.EOF && (MM_size < 0 || i < MM_offset + MM_size); i++) {
MM_rs.MoveNext();
}
// if we walked off the end of the recordset, set MM_rsCount and MM_size
if (MM_rs.EOF) {
MM_rsCount = i;
if (MM_size < 0 || MM_size > MM_rsCount) MM_size = MM_rsCount;
}
// if we walked off the end, set the offset based on page size
if (MM_rs.EOF && !MM_paramIsDefined) {
if ((MM_rsCount % MM_size) != 0) { // last page not a full repeat region
MM_offset = MM_rsCount - (MM_rsCount % MM_size);
} else {
MM_offset = MM_rsCount - MM_size;
}
}
// reset the cursor to the beginning
if (MM_rs.CursorType > 0) {
if (!MM_rs.BOF) MM_rs.MoveFirst();
} else {
MM_rs.Requery();
}
// move the cursor to the selected record
for (var i=0; !MM_rs.EOF && i < MM_offset; i++) {
MM_rs.MoveNext();
}
}
%>
<%
// *** Move To Record: update recordset stats
// set the first and last displayed record
rs_chanping_first = MM_offset + 1;
rs_chanping_last = MM_offset + MM_size;
if (MM_rsCount != -1) {
rs_chanping_first = Math.min(rs_chanping_first, MM_rsCount);
rs_chanping_last = Math.min(rs_chanping_last, MM_rsCount);
}
// set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount != -1 && MM_offset + MM_size >= MM_rsCount);
%>
<%
// *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
// create the list of parameters which should not be maintained
var MM_removeList = "&index=";
if (MM_paramName != "") MM_removeList += "&" + MM_paramName.toLowerCase() + "=";
var MM_keepURL="",MM_keepForm="",MM_keepBoth="",MM_keepNone="";
// add the URL parameters to the MM_keepURL string
for (var items=new Enumerator(Request.QueryString); !items.atEnd(); items.moveNext()) {
var nextItem = "&" + items.item().toLowerCase() + "=";
if (MM_removeList.indexOf(nextItem) == -1) {
MM_keepURL += "&" + items.item() + "=" + Server.URLencode(Request.QueryString(items.item()));
}
}
// add the Form variables to the MM_keepForm string
for (var items=new Enumerator(Request.Form); !items.atEnd(); items.moveNext()) {
var nextItem = "&" + items.item().toLowerCase() + "=";
if (MM_removeList.indexOf(nextItem) == -1) {
MM_keepForm += "&" + items.item() + "=" + Server.URLencode(Request.Form(items.item()));
}
}
// create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL + MM_keepForm;
if (MM_keepBoth.length > 0) MM_keepBoth = MM_keepBoth.substring(1);
if (MM_keepURL.length > 0) MM_keepURL = MM_keepURL.substring(1);
if (MM_keepForm.length > 0) MM_keepForm = MM_keepForm.substring(1);
%>
<%
// *** Move To Record: set the strings for the first, last, next, and previous links
var MM_moveFirst="",MM_moveLast="",MM_moveNext="",MM_movePrev="";
var MM_keepMove = MM_keepBoth; // keep both Form and URL parameters for moves
var MM_moveParam = "index";
// if the page has a repeated region, remove 'offset' from the maintained parameters
if (MM_size > 1) {
MM_moveParam = "offset";
if (MM_keepMove.length > 0) {
params = MM_keepMove.split("&");
MM_keepMove = "";
for (var i=0; i < params.length; i++) {
var nextItem = params[i].substring(0,params[i].indexOf("="));
if (nextItem.toLowerCase() != MM_moveParam) {
MM_keepMove += "&" + params[i];
}
}
if (MM_keepMove.length > 0) MM_keepMove = MM_keepMove.substring(1);
}
}
// set the strings for the move to links
if (MM_keepMove.length > 0) MM_keepMove += "&";
var urlStr = Request.ServerVariables("URL") + "?" + MM_keepMove + MM_moveParam + "=";
MM_moveFirst = urlStr + "0";
MM_moveLast = urlStr + "-1";
MM_moveNext = urlStr + (MM_offset + MM_size);
MM_movePrev = urlStr + Math.max(MM_offset - MM_size,0);
%>
<%
if(MM_size) {
var rs_chanping_TFMcurrentPage = Math.round(rs_chanping_last/MM_size);
var rs_chanping_TFMtotalPages = Math.round(rs_chanping_total/MM_size);
}
%>

|
 |
|
width="100%"> | width="100%"> onmouseover="mOvr(this,'#ffffff');"> width="17%"> width=5> | href="#">男单鞋 | height=1> | height=1> | onmouseover="mOvr(this,'#ffffff');"> width="17%"> width=5> | href="#">女单鞋 | height=1> | height=1> | onmouseover="mOvr(this,'#ffffff');"> width="17%"> width=5> | href="#">男凉鞋 | height=1> | height=1> | onmouseover="mOvr(this,'#ffffff');"> width="17%"> width=5> | href="#">女凉鞋 | height=1> | height=1> | onmouseover="mOvr(this,'#ffffff');"> width="17%"> width=5> | href="#">男棉鞋 | height=1> | height=1> | onmouseover="mOvr(this,'#ffffff');"> width="17%"> width=5> | href="#">女棉鞋 | height=1> | height=1> | | | width="100%"> onmouseover="mOvr(this,'#ffffff');"> width="17%"> width=5> | href="#">产品展示 | | | onmouseover="mOvr(this,'#ffffff');"> width="17%"> width=5> | href="#">精品推荐 | | | onmouseover="mOvr(this,'#ffffff');"> width="17%"> width=5> | href="#">新品展示 | | height=1> | | |
| | | | <% var startrw=0; var endrw=HLooper1__index; var numberColumns=2; var numrows=2; while((numrows-- !=0) && (!rs_chanping.EOF)) { startrw=endrw + 1; endrw = endrw + numberColumns; %> <% while ((startrw <= endrw) && (!rs_chanping.EOF)) { %> " width="160" height="160" onMouseOut=nereidFade(this,66,7,5) onMouseOver=nereidFade(this,100,5,7) style="BORDER-BOTTOM: #666666 1px solid; BORDER-LEFT: #666666 1px solid; BORDER-RIGHT: #666666 1px solid; BORDER-TOP: #666666 1px solid; FILTER: alpha(opacity=95)"> | 货号:<%=(rs_chanping.Fields.Item("货号").value)%> | 产品类别:<%=(rs_chanping.Fields.Item("产品类别").value)%> | 用户对象:<%=(rs_chanping.Fields.Item("用户对象").value)%> | 规格:<%=(rs_chanping.Fields.Item("规格").value)%> | 颜色:<%=(rs_chanping.Fields.Item("颜色").value)%> | 面料:<%=(rs_chanping.Fields.Item("面料").value)%> | 单价:¥<%=(rs_chanping.Fields.Item("单价").value)%> | 产品描述:<%=(rs_chanping.Fields.Item("产品描述").value)%> |
|
| <% startrw = startrw+1; rs_chanping.MoveNext(); } %> <% }%>
| |
|
|
|
|
Copyright©浙江蜘蛛王鞋业有限公司 All Rights Reserved.
E-mail:info@chinazzw.com |
<%
rs_chanping.Close();
%>
结果返馈页程序
---------------------------------------------------------------------------------------
<%@LANGUAGE="javascript" CODEPAGE="936"%>
<%
var rs_search__MMColParam = "";
if (String(Request.QueryString("search")) != "undefined" &&
String(Request.QueryString("search")) != "") {
rs_search__MMColParam = String(Request.QueryString("search"));
}
%>
<%
var rs_search = Server.CreateObject("ADODB.Recordset");
rs_search.ActiveConnection = MM_products_STRING;
rs_search.Source = "SELECT 货号, 产品类别, 用户对象, 规格, 颜色, 面料, 产品图片, 单价, 产品描述 FROM 产品 WHERE 货号 = '"+ rs_search__MMColParam.replace(/'/g, "''") + "'";
rs_search.CursorType = 0;
rs_search.CursorLocation = 2;
rs_search.LockType = 1;
rs_search.Open();
var rs_search_numRows = 0;
%>
<%
// *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
// set the record count
var rs_search_total = rs_search.RecordCount;
// set the number of rows displayed on this page
if (rs_search_numRows < 0) { // if repeat region set to all records
rs_search_numRows = rs_search_total;
} else if (rs_search_numRows == 0) { // if no repeat regions
rs_search_numRows = 1;
}
// set the first and last displayed record
var rs_search_first = 1;
var rs_search_last = rs_search_first + rs_search_numRows - 1;
// if we have the correct record count, check the other stats
if (rs_search_total != -1) {
rs_search_numRows = Math.min(rs_search_numRows, rs_search_total);
rs_search_first = Math.min(rs_search_first, rs_search_total);
rs_search_last = Math.min(rs_search_last, rs_search_total);
}
%>
<%
// *** Recordset Stats: if we don't know the record count, manually count them
if (rs_search_total == -1) {
// count the total records by iterating through the recordset
for (rs_search_total=0; !rs_search.EOF; rs_search.MoveNext()) {
rs_search_total++;
}
// reset the cursor to the beginning
if (rs_search.CursorType > 0) {
if (!rs_search.BOF) rs_search.MoveFirst();
} else {
rs_search.Requery();
}
// set the number of rows displayed on this page
if (rs_search_numRows < 0 || rs_search_numRows > rs_search_total) {
rs_search_numRows = rs_search_total;
}
// set the first and last displayed record
rs_search_last = Math.min(rs_search_first + rs_search_numRows - 1, rs_search_total);
rs_search_first = Math.min(rs_search_first, rs_search_total);
}
%>
<% var MM_paramName = ""; %>
<%
// *** Move To Record and Go To Record: declare variables
var MM_rs = rs_search;
var MM_rsCount = rs_search_total;
var MM_size = rs_search_numRows;
var MM_uniqueCol = "";
MM_paramName = "";
var MM_offset = 0;
var MM_atTotal = false;
var MM_paramIsDefined = (MM_paramName != "" && String(Request(MM_paramName)) != "undefined");
%>
<%
// *** Move To Record: handle 'index' or 'offset' parameter
if (!MM_paramIsDefined && MM_rsCount != 0) {
// use index parameter if defined, otherwise use offset parameter
r = String(Request("index"));
if (r == "undefined") r = String(Request("offset"));
if (r && r != "undefined") MM_offset = parseInt(r);
// if we have a record count, check if we are past the end of the recordset
if (MM_rsCount != -1) {
if (MM_offset >= MM_rsCount || MM_offset == -1) { // past end or move last
if ((MM_rsCount % MM_size) != 0) { // last page not a full repeat region
MM_offset = MM_rsCount - (MM_rsCount % MM_size);
} else {
MM_offset = MM_rsCount - MM_size;
}
}
}
// move the cursor to the selected record
for (var i=0; !MM_rs.EOF && (i < MM_offset || MM_offset == -1); i++) {
MM_rs.MoveNext();
}
if (MM_rs.EOF) MM_offset = i; // set MM_offset to the last possible record
}
%>
<%
// *** Move To Record: if we dont know the record count, check the display range
if (MM_rsCount == -1) {
// walk to the end of the display range for this page
for (var i=MM_offset; !MM_rs.EOF && (MM_size < 0 || i < MM_offset + MM_size); i++) {
MM_rs.MoveNext();
}
// if we walked off the end of the recordset, set MM_rsCount and MM_size
if (MM_rs.EOF) {
MM_rsCount = i;
if (MM_size < 0 || MM_size > MM_rsCount) MM_size = MM_rsCount;
}
// if we walked off the end, set the offset based on page size
if (MM_rs.EOF && !MM_paramIsDefined) {
if ((MM_rsCount % MM_size) != 0) { // last page not a full repeat region
MM_offset = MM_rsCount - (MM_rsCount % MM_size);
} else {
MM_offset = MM_rsCount - MM_size;
}
}
// reset the cursor to the beginning
if (MM_rs.CursorType > 0) {
if (!MM_rs.BOF) MM_rs.MoveFirst();
} else {
MM_rs.Requery();
}
// move the cursor to the selected record
for (var i=0; !MM_rs.EOF && i < MM_offset; i++) {
MM_rs.MoveNext();
}
}
%>
<%
// *** Move To Record: update recordset stats
// set the first and last displayed record
rs_search_first = MM_offset + 1;
rs_search_last = MM_offset + MM_size;
if (MM_rsCount != -1) {
rs_search_first = Math.min(rs_search_first, MM_rsCount);
rs_search_last = Math.min(rs_search_last, MM_rsCount);
}
// set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount != -1 && MM_offset + MM_size >= MM_rsCount);
%>
<%
// *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
// create the list of parameters which should not be maintained
var MM_removeList = "&index=";
if (MM_paramName != "") MM_removeList += "&" + MM_paramName.toLowerCase() + "=";
var MM_keepURL="",MM_keepForm="",MM_keepBoth="",MM_keepNone="";
// add the URL parameters to the MM_keepURL string
for (var items=new Enumerator(Request.QueryString); !items.atEnd(); items.moveNext()) {
var nextItem = "&" + items.item().toLowerCase() + "=";
if (MM_removeList.indexOf(nextItem) == -1) {
MM_keepURL += "&" + items.item() + "=" + Server.URLencode(Request.QueryString(items.item()));
}
}
// add the Form variables to the MM_keepForm string
for (var items=new Enumerator(Request.Form); !items.atEnd(); items.moveNext()) {
var nextItem = "&" + items.item().toLowerCase() + "=";
if (MM_removeList.indexOf(nextItem) == -1) {
MM_keepForm += "&" + items.item() + "=" + Server.URLencode(Request.Form(items.item()));
}
}
// create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL + MM_keepForm;
if (MM_keepBoth.length > 0) MM_keepBoth = MM_keepBoth.substring(1);
if (MM_keepURL.length > 0) MM_keepURL = MM_keepURL.substring(1);
if (MM_keepForm.length > 0) MM_keepForm = MM_keepForm.substring(1);
%>
<%
// *** Move To Record: set the strings for the first, last, next, and previous links
var MM_moveFirst="",MM_moveLast="",MM_moveNext="",MM_movePrev="";
var MM_keepMove = MM_keepBoth; // keep both Form and URL parameters for moves
var MM_moveParam = "index";
// if the page has a repeated region, remove 'offset' from the maintained parameters
if (MM_size > 1) {
MM_moveParam = "offset";
if (MM_keepMove.length > 0) {
params = MM_keepMove.split("&");
MM_keepMove = "";
for (var i=0; i < params.length; i++) {
var nextItem = params[i].substring(0,params[i].indexOf("="));
if (nextItem.toLowerCase() != MM_moveParam) {
MM_keepMove += "&" + params[i];
}
}
if (MM_keepMove.length > 0) MM_keepMove = MM_keepMove.substring(1);
}
}
// set the strings for the move to links
if (MM_keepMove.length > 0) MM_keepMove += "&";
var urlStr = Request.ServerVariables("URL") + "?" + MM_keepMove + MM_moveParam + "=";
MM_moveFirst = urlStr + "0";
MM_moveLast = urlStr + "-1";
MM_moveNext = urlStr + (MM_offset + MM_size);
MM_movePrev = urlStr + Math.max(MM_offset - MM_size,0);
%>
<%
if(MM_size) {
var rs_search_TFMcurrentPage = Math.round(rs_search_last/MM_size);
var rs_search_TFMtotalPages = Math.round(rs_search_total/MM_size);
}
%>
<%
rs_search.Close();
%>