你可以用下面的代碼試試...
<div id="quicksearch">
<form id="cse-search-box" action="search.html">
<div style="float:left">
<input type="hidden" value="005780201047221652427:jopxospdjss" name="cx">
<input type="hidden" value="FORID:10" name="cof">
<input type="hidden" value="UTF-8" name="ie">
<input type="text" onblur="if(this.value=='')value='Search Site';" onfocus="if(this.value=='Search Site')value=''" value="Search Site" class="searchBox" size="28" name="q">
</div>
<div style="float:left;">
<input class="image" type="submit" value="" name="sa">
</div>
</form>
</div>
你可以嘗試用自己的CSS有以下幾點: -
#quicksearch .searchBox{background:#666666; border:#666666 0px solid; height:22px; color:#CCCCCC; font-size:12px; padding-left:6px;}
#quicksearch .image {
background: url("search.png") no-repeat scroll center top transparent;
border: 0 none;
cursor: pointer;
display: block !important;
height: 23px;
width: 23px;
}
要顯示搜索記錄,請創建一個名稱爲「search.html」的新文件並粘貼以下代碼 那裏。搜索記錄將顯示在此頁面下方。
<div id="cse-search-results"></div>
<script type="text/javascript">
var googleSearchIframeName = "cse-search-results";
var googleSearchFormName = "cse-search-box";
var googleSearchFrameWidth = 800;
var googleSearchDomain = "www.google.com";
var googleSearchPath = "/cse";
</script>
<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>
難道你錯過了底部代碼中的某些東西嗎?該變量甚至沒有使用... –
在這裏找到文檔:http://www.google.com/cse/docs/cref.html –