日期:2014-05-16 浏览次数:20393 次
<%@ page language="java" pageEncoding="UTF-8"%> <%if(request.getParameter("name")==null) response.sendRedirect("dl.jsp"); String name=request.getParameter("name"); session.setAttribute("name",name); %> <html> <head> <title>31231</title> <script type='text/javascript' src="${pageContext.request.contextPath}/dwr/engine.js"></script> <script type='text/javascript' src="${pageContext.request.contextPath}/dwr/util.js"></script> <script type='text/javascript' src="${pageContext.request.contextPath}/dwr/interface/searchService2.js"></script> <script type='text/javascript' src="${pageContext.request.contextPath}/dwr/interface/searchService.js"></script> <style type="text/css"> .div_cont { width: 1000px; float: left; margin: 10px; } #result { width: 800px; float: left; margin-top: 5px; } #paging { width: 800px; float: left; margin-top: 5px; } </style> <script language="javascript"> var request; var minpage; var maxpage; var startindex; var hasnext; function doSearch(type) { var result = document.getElementById("result"); var pagingdiv = document.getElementById('paging'); result.innerHTML = ""; pagingdiv.innerHTML = ""; if (type != 'paging') { var startindexinput = document.getElementById('startindex'); startindexinput.value = "1"; } request = { startindex : 1, query : "" }; DWRUtil.getValues(request); //DWREngine.setAsync(true); if (request.query == "") { alert("请输入正确的词"); } else { searchService.getSearchResults(request, fillPage); } //DWREngine.setAsync(false); } function fillPage(data) { // alert(DWRUtil.toDescriptiveString(data, 2)); var resultdiv = document.getElementById('result'); var pagingdiv = document.getElementById('paging'); resultdiv.innerHTML = ""; pagingdiv.innerHTML = ""; if (data.length == 0) { resultdiv.innerHTML = "<span>sorry, we can't find what you want...</span>"; return; } if (null != data) { for ( var i = 0; i < data.length; i++) { //alert(data[i].id); var results = data[i]; //alert(results); var ele = document.createElement('div'); ele.setAttribute('id', 'info' + i); ele.innerHTML = "<span>loading..</span>"; resultdiv.appendChild(ele); var res = document.getElementById('info' + i); //res.innerHTML="<font color=\"#0033CC\">" + title[i] + "</font><br /><a href=\"" + url[i] + "\">" res.innerHTML = "<a href=\"" + data[i].url + "\">" + "<font color=\"#0033CC\">" + results.title + "</font></a><br /><font color=\"#008000\">&