Carregar primeiro e Mais rapido codigo javascript
CODE
<script type="text/javascript">
// the cse class encapsulates a left and right search control
// both controls are driven by a shared search form
function cse() {
var sFormDiv = document.getElementById("searchForm");
var rightScDiv = document.getElementById("rightSearchControl");
// create a left, right search control
// create a custom search form
this.rightControl = new GSearchControl();
this.searchForm = new GSearchForm(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.rightControl.setResultSetSize(GSearch.LARGE_RESULTSET);
this.rightControl.setNoResultsString("No results");
var searcher;
var options;
// configure right control for
// -- cse for comparisons
// -- cse for community
// -- cse for shopping
// -- blog search
// -- video search
<? if($gets[1] == "sites") {?>
searcher = new GwebSearch();
options = new GsearcherOptions();
searcher.setSiteRestriction("016147173337712478936:hc9gjh7sqoe");
//searcher.setUserDefinedLabel("Webs Gospel");
options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
this.rightControl.addSearcher(searcher, options);
<? } ?>
// draw the left and right controls
// the right control is drawn in tabbed mode
var drawOptions = new GdrawOptions();
drawOptions.setDrawMode(GSearchControl.DRAW_MODE_TABBED);
this.rightControl.draw(rightScDiv, drawOptions);
// execute a starter search
this.searchForm.execute("palavrachave");
}
// when the form fires a submit, grab its
// value and call the left and right control
cse.prototype.onSubmit = function(form) {
var q = form.input.value;
if (q && q!= "") {
this.rightControl.execute(q);
}
return false;
}
// when the form fires a clear, call the left and right control
cse.prototype.onClear = function(form) {
this.rightControl.clearAllResults();
form.input.value = "";
return false;
}
function OnLoad() {
new cse();
}
GSearch.setOnLoadCallback(OnLoad);
</script>
preciso fazer este codigo carregar primeiro que tudo na pagina, e se alguem souber deixar ele mais limpo.. agradeceria muitoo!!
Discussão (2)
Carregando comentários...