GoogleSerch

<!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=utf-8"/>
    
<title>GoogleSearch</title>
    
<link href="http://www.google.com/uds/css/gsearch.css" type="text/css" rel="stylesheet" />
    
<script src="http://www.google.com/uds/api?file=uds.js&amp;v=1.0&amp;key=ABQIAAAAbKU1_TiGJxAPxQNRN0Z7thQEKx5ztgmPnP8AiUB_ZtaZmH_j4xR_bAGbjyG4GamffxBhkZcRXMQE0A" type="text/javascript"></script>
    
    
<script type="text/javascript">
    
var searchControl;
    window.onload 
= function() {
        onLoad();
    }
    
function onLoad() {
        searchControl 
= new GSearchControl();

        
//搜索WEB
        var webSrearch = new GwebSearch();
        webSrearch.setUserDefinedLabel(
"web");
        searchControl.addSearcher(webSrearch);
        
//搜索BLOG
        var blogsSrearch = new GblogSearch();
        blogsSrearch.setUserDefinedLabel(
"weblogs");
        searchControl.addSearcher(blogsSrearch);
        
//搜索news
        var newsSrearch = new GnewsSearch();
        newsSrearch.setUserDefinedLabel(
"news");
        searchControl.addSearcher(newsSrearch);
        
//搜索local
        var localSrearch = new GlocalSearch();
        localSrearch.setUserDefinedLabel(
"local");
        searchControl.addSearcher(localSrearch);
        
//搜索video
        var videoSrearch = new GvideoSearch();
        videoSrearch.setUserDefinedLabel(
"video");
        searchControl.addSearcher(videoSrearch);
        
//搜索book
        var bookSrearch = new GbookSearch();
        bookSrearch.setUserDefinedLabel(
"book");
        searchControl.addSearcher(bookSrearch);

        
//在cnblogs中搜索
        var siteSearch1 = new GwebSearch();
        siteSearch1.setUserDefinedLabel(
"cnblogs.com");
        siteSearch1.setSiteRestriction(
"cnblogs.com");
        searchControl.addSearcher(siteSearch1);
        
//在csdn中搜索
        var siteSearch2 = new GwebSearch();
        siteSearch2.setUserDefinedLabel(
"csdn.net");
        siteSearch2.setSiteRestriction(
"csdn.net");
        searchControl.addSearcher(siteSearch2);

        
var drawOptions = new GdrawOptions();
        drawOptions.setDrawMode(GSearchControl.DRAW_MODE_TABBED);
        drawOptions.setInput(document.getElementById('query'));
        searchControl.draw(document.getElementById(
"searchcontrol"), drawOptions);
        GSearch.getBranding(document.getElementById(
"branding"));
    }
    
    
var query = null;
    document.onkeydown 
= function(event) { kd(event); };
    
function kd(e) {
        
if (!e) e = event;
        
if (e.keyCode == 27)
            searchControl.clearAllResults();
        
if (query == null)
            query 
= document.getElementById('query');
        query.focus();
    }
    
</script>
    
    
<style type="text/css">
    body
    
{
        FONT-SIZE
: 11px;
        font-family
: verdana;
        text-align
: left;
    
}
    #queryContainer
    
{
        margin-bottom
:2em;
        width
: 80%;
        margin-left
:auto;
        margin-right
:auto;
    
}
    #query
    
{
        border
:1px solid silver;
        width
: 100%;
    
}
    #searchcontrol
    
{
        width
:80%;
        margin-left
:auto;
        margin-right
:auto;
        text-align
:left;
    
}
    .gsc-control 
    
{ 
        width
: 100%; 
    
}
    
</style>
</head>
<body>
<input type="text" style="width:300px;" name="query" id="query" /><br />
<div id="searchcontrol"></div>
</body>
</html>

posted on 2007-03-28 11:43  苍冥  阅读(746)  评论(0编辑  收藏  举报

导航