使用 Rico JavaScript 库、ColdFusion MX 7 和 Windows Indexing Service 构建一个启用 Ajax 的搜索页面
2010-03-09 00:00:00 来源:WEB开发网图 5. 搜索表单
清单 1. 搜索工具的用户界面 (ajax_search.cfm)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Search</title>
<script src="prototype.js"></script>
<script src="rico.js"></script>
<script language="JavaScript">
var CurrentPage = 1;
function onLoad() {
ajaxEngine.registerRequest('getSearchResults','ajax_results.cfm');
ajaxEngine.registerAjaxElement('SearchResults');
}
function getResults(RequestedPage) {
var SearchString = document.SearchForm.qu.value;
CurrentPage = RequestedPage;
ajaxEngine.sendRequest('getSearchResults',
"qu=" + SearchString,
"pg=" + RequestedPage);
}
function getPreviousResults() {
getResults(CurrentPage-1);
}
function getNextResults() {
getResults(CurrentPage+1);
}
</script>
</head>
<body >
<h1>Search</h1>
<cfform name="SearchForm" method="post" action="#CGI.SCRIPT_NAME#"
>
<cfinput type="text" name="qu" size="50" maxlength="100" value="">
<cfinput type="submit" name="" value="Search">
</cfform>
<div id="SearchResults">
</div>
</body>
</html>
Tags:使用 Rico JavaScript
编辑录入:爽爽 [复制链接] [打 印]更多精彩
赞助商链接