搜索结果经过匹配后被加载到iframe里,速度慢,哪里改进下,加快点速度?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>zhua</title>
<script src="http://www.google.com.hk/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1');
function cse() {
var sFormDiv = document.getElementById("searchForm");
var leftScDiv = document.getElementById("leftSearchControl");
this.leftControl = new google.search.SearchControl();
this.searchForm = new google.search.SearchForm(true, sFormDiv);
// bind clear and submit functions
this.searchForm.setOnSubmitCallback(this, cse.prototype.onSubmit);
this.searchForm.setOnClearCallback(this, cse.prototype.onClear);
// set up for small result sets
this.leftControl.setResultSetSize(google.search.Search.LARGE_RESULTSET); var searcher;
var options;
// configure left control
// Site Restrict to CSE ID for reviews
searcher = new google.search.WebSearch();
options = new google.search.SearcherOptions();
searcher.setSiteRestriction('017315707308107628641:ldi_rm4utyi');
//searcher.setUserDefinedLabel("Product Reviews");
options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
this.leftControl.addSearcher(searcher, options);
this.leftControl.draw(leftScDiv);
// execute a starter search
this.searchForm.execute("<?php echo $_GET['keyword'];?>");
}
cse.prototype.onSubmit = function(form) {
var q = form.input.value;
if (q && q!= "") {
this.leftControl.execute(q);
}
return false;
}
function OnLoad() {
new cse();
}google.setOnLoadCallback(OnLoad, true);</script>
</head>
<body>
<div id="searchForm"></div>
<div id="leftSearchControl" class="search-control"></div>
<script type="javascript">
window.onload = function (){
document.write(document.getElementById("leftSearchControl").innerHTML);
}
</script>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>zhua</title>
<script src="http://www.google.com.hk/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1');
function cse() {
var sFormDiv = document.getElementById("searchForm");
var leftScDiv = document.getElementById("leftSearchControl");
this.leftControl = new google.search.SearchControl();
this.searchForm = new google.search.SearchForm(true, sFormDiv);
// bind clear and submit functions
this.searchForm.setOnSubmitCallback(this, cse.prototype.onSubmit);
this.searchForm.setOnClearCallback(this, cse.prototype.onClear);
// set up for small result sets
this.leftControl.setResultSetSize(google.search.Search.LARGE_RESULTSET); var searcher;
var options;
// configure left control
// Site Restrict to CSE ID for reviews
searcher = new google.search.WebSearch();
options = new google.search.SearcherOptions();
searcher.setSiteRestriction('017315707308107628641:ldi_rm4utyi');
//searcher.setUserDefinedLabel("Product Reviews");
options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
this.leftControl.addSearcher(searcher, options);
this.leftControl.draw(leftScDiv);
// execute a starter search
this.searchForm.execute("<?php echo $_GET['keyword'];?>");
}
cse.prototype.onSubmit = function(form) {
var q = form.input.value;
if (q && q!= "") {
this.leftControl.execute(q);
}
return false;
}
function OnLoad() {
new cse();
}google.setOnLoadCallback(OnLoad, true);</script>
</head>
<body>
<div id="searchForm"></div>
<div id="leftSearchControl" class="search-control"></div>
<script type="javascript">
window.onload = function (){
document.write(document.getElementById("leftSearchControl").innerHTML);
}
</script>
</body>
</html>
估计是网速和google API调用数据库的返回时间,有关系。