百度贴吧的输入框输入一个字符进去后,会有下拉框,里面有相关的选项,如何使用js代码调用百度数据库的内容使输入框输入字符后会有百度那个下拉框,是用百度贴吧的数据库,如:在百度贴吧输入框输入:1,会有一等家丁、一剑凌尘、一路荣华……一露

解决方案 »

  1.   

    ajax调用应该可以吧,就是不知道百度限制了没有
      

  2.   

    http://tieba.baidu.com/sug?query=STRINGSTRING = encodeURI("你输入的关键词")查看方法:
    用FIREFOX浏览百度贴吧,THEN打开FIREBUG——“网络”——“XHR”,THEN随便输入文字——下拉框出现——在FIREBUG下面就能看到和直接COPY到手了。
      

  3.   

    TEST DEMO:<script type=text/javascript>
    var URL = "http://tieba.baidu.com/sug?query=" + encodeURI("一");
    var XML = new XMLHttpRequest() || new ActiveXObject("^o^||Microsoft.XMLHTTP"||"MSXML.XMLHTTP");
    XML.open( "GET", URL, true );
    XML.onreadystatechange = function() {
        if (XML.readyState == 4) { 
            !/200|0/.test(XML.status) || alert(XML.responseText) ;
            XML = null;  
        }
    }
    XML.send(null);
    </script>
      

  4.   

    ajax,返回查询的数据,用层把data组装起来
      

  5.   

    刚才见人把帖子顶上来了,又看了看,发现该API(http://tieba.baidu.com/sug?query=STRING)是有自定义句柄的(path + &callback=函数名,但函数名不能够用“baidu.sug”),典型的JSONP模式。有兴趣仔细看了下百度其他栏目的相关API,发现“地图”的也一样属JSONP,其余的也固定提供了函数句柄“baidu.sug”。度娘是很人性化的,这样可以客户端直接SCRIPT动态加载回调获取相关数据,避免使用AJAX带来的跨域问题。
    TEST DEMO:<Script Type=Text/Javascript>
    var QuoteBaidu = baidu = {};
    QuoteBaidu.API = {
        "网页" : "http://suggestion.baidu.com/su?wd=Keyword",
        "MP3"  : "http://nssug.baidu.com/su?wd=Keyword&prod=mp3",
        "视频" : "http://nssug.baidu.com/su?wd=Keyword&prod=video",
        "图片" : "http://nssug.baidu.com/su?wd=Keyword&prod=image",
        "知道" : "http://nssug.baidu.com/su?wd=Keyword&prod=zhidao",
        "新闻" : "http://nssug.baidu.com/su?wd=Keyword&prod=news",
        "文库" : "http://nssug.baidu.com/su?wd=Keyword&prod=wenku",
        "百科" : "http://nssug.baidu.com/su?wd=Keyword&prod=baike",
        "词典" : "http://dictsug.baidu.com/su?wd=Keyword",
        "贴吧" : "http://tieba.baidu.com/sug?query=Keyword",
        "地图" : "http://map.baidu.com/su?wd=Keyword&cid=257&type=0&newmap=1&callback=baidu.sug"
    }
    QuoteBaidu.getPrompt = function(why, word, fun, err) {
        var str = new Date().getTime(); 
        var url = this.API[why].replace(/\bKeyword\b/g, word) + "&_=" + str;
        why == "贴吧" && (url += "&callback=jsonp" + str); //贴吧相关回调函数名字符中不能有“.”
        var appendTo = document.getElementsByTagName("head")[0];
        var oScripts = document.createElement("script");
        oScripts.type = "text/javascript";
        oScripts.src  = encodeURI(url);
        oScripts.onerror = function() {
            typeof err != "function" || err.apply(QuoteBaidu, oScripts);
            appendTo.removeChild(oScripts);
        }
        window["jsonp" + str] = this.sug = function(arg) {
            typeof fun != "function" || fun.apply(QuoteBaidu, [arg["s"]||arg["msg"]]);
            appendTo.appendChild(oScripts);
        }
        appendTo.appendChild(oScripts);
    }
    //调用:
    QuoteBaidu.getPrompt("贴吧", "春", function(info) {
             alert(info);
         }, function() {
             alert("加载失败");
         });
    </Script>
      

  6.   

    又发现了“搜索指数”相关API,达到了12个。<Script Type=Text/Javascript>
    var QuoteBaidu = baidu = {};
    QuoteBaidu.API = {
        "网页" : "http://suggestion.baidu.com/su?wd=Keyword",
        "MP3"  : "http://nssug.baidu.com/su?wd=Keyword&prod=mp3",
        "视频" : "http://nssug.baidu.com/su?wd=Keyword&prod=video",
        "图片" : "http://nssug.baidu.com/su?wd=Keyword&prod=image",
        "知道" : "http://nssug.baidu.com/su?wd=Keyword&prod=zhidao",
        "新闻" : "http://nssug.baidu.com/su?wd=Keyword&prod=news",
        "文库" : "http://nssug.baidu.com/su?wd=Keyword&prod=wenku",
        "百科" : "http://nssug.baidu.com/su?wd=Keyword&prod=baike",
        "指数" : "http://nssug.baidu.com/su?wd=Keyword&prod=index",
        "词典" : "http://dictsug.baidu.com/su?wd=Keyword",
        "贴吧" : "http://tieba.baidu.com/sug?query=Keyword",
        "地图" : "http://map.baidu.com/su?wd=Keyword&cid=257&type=0&newmap=1&callback=baidu.sug"
    }
    QuoteBaidu.getPrompt = function(whiles, word, fun, err) {
        var str = new Date().getTime(); 
        var url = this.API[whiles].replace(/\bKeyword\b/g, word) + "&_=" + str;
        url += whiles == "贴吧" ? "&callback=jsonp" + str : ""; //贴吧相关回调函数名字符中不能有“.”
        var appendTo = document.getElementsByTagName("head")[0];
        var oScripts = document.createElement("script");
        oScripts.type = "text/javascript";
        oScripts.src  = encodeURI(url);
        oScripts.onerror = function() {
            typeof err != "function" || err.apply(QuoteBaidu, oScripts);
            appendTo.removeChild(oScripts);
        }
        window["jsonp" + str] = this.sug = function(arg) {
            typeof fun != "function" || fun.apply(QuoteBaidu, [arg["s"]||arg["msg"]]);
            appendTo.appendChild(oScripts);
        }
        appendTo.appendChild(oScripts);
    }
    //调用方式:
    QuoteBaidu.getPrompt("贴吧", "春", function(info) {
             alert(info);
         }, function() {
             alert("加载失败");
         });
    </Script>
      

  7.   

    唉,随手写错了一句,又不能编辑,只好明确认错更正了。
    错:    window["jsonp" + str] = this.sug = function(arg) {
            typeof fun != "function" || fun.apply(QuoteBaidu, [arg["s"]||arg["msg"]]);
            appendTo.appendChild(oScripts);
        }更正:    window["jsonp" + str] = this.sug = function(arg) {
            typeof fun != "function" || fun.apply(QuoteBaidu, [arg["s"]||arg["msg"]]);
            appendTo.removeChild(oScripts);
        }
      

  8.   

    这是百度MP3的头部输入框和下拉框那部分 ,怎么将你的代码和这个HTML结合呢  帮下  小白  多谢啊
    <!DOCTYPE HTML> <html  lang="zh-CN"><head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"><meta name="description" content="百度MP3"><title>百度MP3——全球最大中文音乐搜索平台</title><link rel="stylesheet" href="mp3.css" type="text/css"><base target="_blank" /></head><body class="mp3-index">    <div class="wp">
        
            <div class="hd"  monkey="hd" id="search">            <div class="lg"> 
                    <a href="http://mp3.baidu.com" target="_self"><img src="http://list.mp3.baidu.com/images/bXAzaW5kZXg-/v2_0/mp3-logo.png" alt="百度MP3"></a> 
                </div>
            
                <div class="search-wrap">
                
                    <div class="lk"> 
                        <a href="http://news.baidu.com/" target="_self" onClick="s(this)">新闻</a>
                        <a target="_self" href="http://www.baidu.com/" onClick="s(this)">网页</a>
                        <a target="_self" href="http://tieba.baidu.com/" onClick="s(this)">贴吧</a>
                        <a target="_self" href="http://zhidao.baidu.com/" onClick="s(this)">知道</a>
                        <span>MP3</span>
                        <a target="_self" href="http://image.baidu.com/" onClick="s(this)">图片</a>
                        <a href="http://video.baidu.com/" onClick="s(this)" target="_self">视频</a>
                        <a href="http://map.baidu.com/" onClick="s(this)" target="_self">地图</a>
                        <a href="http://ting.baidu.com?fr=mp3-nav" onClick="s(this)" target="_self">ting!</a> 
                    </div>
                
                    <form name="f1" action="http://mp3.baidu.com/m" target="_self" onSubmit="return syn(this)">
                        
                        <input type="hidden" name="f" value="ms">
                        
                        <input type="hidden" name="rf" value="idx">
                        
                        <input type="hidden" name="tn" value="baidump3">
                        
                        <input type="hidden" name="ct" value="134217728">
                        
                        <input type="hidden" name="lf">
                        
                        <input type="hidden" name="rn">
                    
                        <div class="search">
                        
                            <span class="s_ipt_wr">
                                <input type="text" name="word" id="ww" class="kw s_ipt" size="42" maxlength="100" autocomplete="off">
                            </span>
                        
                            <span class="s_btn_wr">
                                <input type="submit" value="百度一下" class="s_btn" onmousedown="this.className='s_btn s_btn_h'" onmouseout="this.className='s_btn'">
                            </span>
                        
                            <span class="s_tools">
                                <a href="http://www.baidu.com/search/mp3_help.html" target="_blank">帮助</a> | <a href="http://mp3.baidu.com/advanced.html" target="_self">高级搜索</a>
                            </span>
                        </div>
                    
                        <div class="cate">
                        
                            <label for="aM">
                            
                            <input name="lm" type="radio" value="-1" id="aM" checked>歌曲 </label>
                            
                            <label for="aW">
                            
                            <input name="lm" type="radio" value="-1" id="aW">歌词 </label>
                        
                        </div>
                    
                    </form>
                
                
                
                </div>
            
            
            
                <form name="vform" id="vform" target="_blank" action="http://video.baidu.com/v">
                
                    <input type=hidden name=ct value="301989888">
                    
                    <input type="hidden" name="rn" value="20">
                    
                    <input type="hidden" name="pn" value="0">
                    
                    <input type="hidden" name="db" value="0">
                    
                    <input type="hidden" name="s" value="3">
                    
                    <input type="hidden" name="word" value="">
                
                </form>
            
            </div>
            
            <div id="userbar">
            </div>
        
    <script type="text/javascript">
                function G(a) {
                    return document.getElementById(a)
                }
            
            
            
                function syn(a) {
                    if (a.lm[1].checked) {
                        setInput(a, "baidump3lyric", "150994944", "10", false)
                    } else {
                        setInput(a, "baidump3", "134217728", false, false)
                    }
                    return true
                }
            
            
            
                function setInput(d, a, e, c, b) {
                    d.tn.value = a;
                    d.ct.value = e;
                    d.rn.value = c ? c : "";
                    d.action = b ? b : "http://mp3.baidu.com/m"
                }
            
            
            
                function setVideoForm(a) {
                    G("vform").word.value = a.word.value;
                    G("vform").submit()
                }
            
            
            
                function gg() {
                    var a = location.search;
                    if (a.indexOf("q=") != -1) {
                        try {
                            var c = (a.match(new RegExp("q=[^&$]*")).toString());
                            document.f1.word.value = decodeURIComponent(c.substr(2))
                        } catch(b) {}
                    }
                }
            
            
            
                function s(c) {
                    if (document.f1.word.value.length > 0) {
                        var d = c.href;
                        var e = encodeURIComponent(document.f1.word.value);
                        if (d.indexOf("q=") != -1) {
                            c.href = d.replace(new RegExp("q=[^&$]*"), "q=" + e)
                        } else {
                            if (d.indexOf("ting") != -1) {
                                var b = c.href.split("?");
                                c.href = b[0] + "search?key=" + e + "&" + b[1]
                            } else {
                                var a = "?";
                                c.href = c.href + a + "q=" + e
                            }
                        }
                    }
                }
            
            
            
                function cc(b) {
                    if (G(b)) {
                        var c = G(b);
                        if (navigator.appName == "Netscape") {
                            c.focus()
                        } else {
                            c.focus();
                            var a = c.createTextRange();
                            a.collapse(false);
                            a.select()
                        }
                    }
                }
                window.onunload = function() {};
                cc("ww");
                gg();
                document.f1.word.focus();
            
                var enterState = (function(sUsrBarWapperID) {
            
                    var oUserInfo, oTemplateMap, sLocation, eUsrBar, bBindUserBar, fEnterState;
            
                    sLocation = encodeURIComponent(location.href);
            
                    oUserInfo = {
            
                        "sTemplate": "guest",
            
                        "sUserName": '',
            
                        "sSpaceLink": '',
            
                        "sProfileURL": 'http://passport.baidu.com/#0,1',
            
                        "sBaiduURL": 'http://www.baidu.com',
            
                        "sLoginURL": 'http://passport.baidu.com/v2/?login&tpl=mp&u=' + sLocation,
            
                        "sRegURL": 'http://passport.baidu.com/v2/?reg&tpl=mp&u=' + sLocation,
            
                        "sLogoutURL": 'http://passport.baidu.com/?logout&tpl=mp&u=' + sLocation,
            
                        'sOpenMbox': '<a href="###" onclick="return omb(),false">音乐盒</a>'
            
                    };
            
                    oTemplateMap = {
            
                        "guest": '<ul><li>#{sOpenMbox}</li><li class="line">|</li><li><a href="#{sBaiduURL}">百度首页</a></li><li class="line">|</li><li><a href="#{sLoginURL}">登录</a><a href="#{sRegURL}">注册</a></li></ul>',
            
                        "user": '<ul><li class="uname mn-lk-w"><a id="anchor-user-name" class="mn-lk" href="###" onclick="return false;" target="_blank">#{sUserName}</a><div id="menu-user"  style="display:none" class="mn-tip" style=" width:75px; right:0;"><ul class="mn"><li><a classs="my-info" href="#{sProfileURL}">个人资料</a></li><li><a href="#{sLogoutURL}" class="logout" target="_self">退出</a></li></ul></div></li><li class="line">|</li><li>#{sOpenMbox}</li><li class="line">|</li><li><a href="#{sBaiduURL}">百度首页</a></li></ul>'
            
                    };
            
                    oCallbacks = {
            
                        "guest": function() {},
            
                        "user": function() {
            
                            var eAnchorUserName, eMenu, iWatchID, iWatchInterval, bAllowHideMenu, bMenuShow;
            
                            eAnchorUserName = document.getElementById('anchor-user-name');
            
                            eMenu = document.getElementById('menu-user');
            
                            iWatchID = -1;
            
                            iWatchInterval = 500;
            
                            bAllowHideMenu = false;
            
                            bMenuShow = false;
      

  9.   

      function hideMenu() {
            
                                if (bAllowHideMenu)
            
                                {
            
                                    if (bMenuShow)
            
                                    {
            
                                        eMenu.style.display = "none";
            
                                        bMenuShow = false;
            
                                        clearInterval(iWatchID);
            
                                        iWatchID = -1;
            
                                    }
            
                                }
            
                            }
            
                            eAnchorUserName.onmouseover = function() {
            
                                if (!bMenuShow)
            
                                {
            
                                    eMenu.style.display = "block";
            
                                    bMenuShow = true;
            
                                    bAllowHideMenu = false;
            
                                    if (iWatchID < 0)
            
                                    {
            
                                        iWatchID = setInterval(hideMenu, iWatchInterval);
            
                                    }
            
                                } else {
            
                                    hideMenu();
            
                                }
            
                                return false
            
                            };
            
                            eAnchorUserName.onmouseout = function() {
            
                                bAllowHideMenu = true;
            
                            };
            
                            eMenu.onmouseover = function() {
            
                                bAllowHideMenu = false;
            
                            };
            
                            eMenu.onmouseout = function() {
            
                                bAllowHideMenu = true;
            
                            };
            
                            oCallbacks.invoked = true;
            
                        }
            
                    };
            
            
            
                    function formatTpl(source, opts) {
            
                        source = String(source);
            
                        var data = Array.prototype.slice.call(arguments, 1),
                            toString = Object.prototype.toString;
            
                        if (data.length) {
            
                            data = data.length == 1 ?
            
                            /* ie 下 Object.prototype.toString.call(null) == '[object Object]' */
            
                            (opts !== null && (/\[object Array\]|\[object Object\]/.test(toString.call(opts))) ? opts : data)
            
                            : data;
            
                            return source.replace(/#\{(.+?)\}/g, function(match, key) {
            
                                var replacer = data[key];
            
                                // chrome 下 typeof /a/ == 'function'
                                if ('[object Function]' == toString.call(replacer)) {
            
                                    replacer = replacer(key);
            
                                }
            
                                return ('undefined' == typeof replacer ? '' : replacer);
            
                            });
            
                        }
            
                        return source;
            
                    };
            
                    fEnterState = function(_oUserInfo) {
            
                        _oUserInfo = _oUserInfo || {};
            
                        for (var i in oUserInfo)
            
                        {
            
                            if (_oUserInfo.hasOwnProperty(i))
            
                            {
            
                                continue;
            
                            }
            
                            _oUserInfo[i] = oUserInfo[i];
            
                        }
            
                        eUsrBar = document.getElementById(sUsrBarWapperID);
            
                        eUsrBar.innerHTML = formatTpl(oTemplateMap[_oUserInfo['sTemplate']], _oUserInfo);
            
                        oCallbacks[_oUserInfo['sTemplate']]();
            
                        return false
            
                    };
            
                    /*
                    
                        @cache bdErrCode
                    
                        @cache uName
                    
                        @cache isOnline
                    
                        @cache isSpaceUser
                    
                        */
            
                    function updateUserState(_oUserInfo) {
            
                        var sUserName, oRtUserInfo;
            
                        sUserName = _oUserInfo.uName + '';
            
                        oRtUserInfo = {};
            
                        if (sUserName.length > 0)
            
                        {
            
                            oRtUserInfo.sTemplate = 'user';
            
                            oRtUserInfo.sUserName = sUserName;
            
                        } else {
            
                            oRtUserInfo.sTemplate = 'guest';
            
                        }
            
                        return fEnterState(oRtUserInfo);
            
                    }
            
            
            
                    function initUserBar() {
            
                        var sc = "http://mp3.baidu.com/dev/api/?tn=checkuser&callback=enterState&r=" + +new Date(),
            
                        d = document.getElementsByTagName('head')[0],
                            s;
            
                        s = document.createElement('script');
            
                        s.src = sc;
            
                        d.appendChild(s);
            
                    }
            
                    if (!window.attachEvent)
            
                    {
            
                        window.addEventListener('load', initUserBar, false);
            
                    } else {
            
                        window.attachEvent('onload', initUserBar);
            
                    }
            
                    return updateUserState;
            
                })('userbar');
            </script>
            
            <map name="map">
            </map>
        </div><!-- wp end -->    <img id="mp3Log" src="" style="display:none"> <script type="text/javascript">
    var commonHeaderConf = {
    sugProdName: "mp3",
    searchInputId: "ww"
    };
    if (navigator.cookieEnabled && !/sug?=0/.test(document.cookie)) {
    document.write('<script src="http://imgs.zhangmen.baidu.com/js/bXAzZ2xvYmFs/v2_0/sug-3.0.js?v=ns3.0"></' + 'script>')
    };
    </script>
         
        
    </body></html>
      

  10.   

    body,div,img,table,tr,tbody,tfoot,td,ul,li,p,h1,h2,h3,h4,h5,dl,dt,dd{
    margin:0;
    padding:0;
    border:0
    }
    input[type="checkbox"]{
    margin:0;
    padding:0
    }
    table{
    border-collapse:collapse;
    border-spacing:0
    }
    th{
    font-weight:normal
    }
    h1,h2,h3,h4,h5{
    font-size:100%
    }
    i,em{
    font-style:normal
    }
    sup{
    vertical-align:middle
    }
    li{
    list-style-type:none
    }
    body{
    font:14px Arial;
    background:#fff
    }
    .clearfix:after{
    content:".";
    display:block;
    height:0;
    clear:both;
    visibility:hidden
    }
    .clearfix{
    display:inline-block
    }
    * html .clearfix{
    height:1%
    }
    .clearfix{
    display:block
    }
    .hide{
    display:none
    }
    .show{
    display:block
    }
    a{
    color:#0043bd
    }
    a:hover{
    color:#f60
    }
    .red{
    color:#ca0101
    }
    .bold{
    font-weight:bold
    }
    .green{
    color:#390
    }
    .orange{
    color:#f60
    }
    .f16{
    font-size:16px
    }
    .f14{
    font-size:14px
    }
    .more{
    font-family:b8bf53
    }
    .module .title{
    background-image:url(http://static.mp3.baidu.com/imgs/bXAzaW5kZXg-/v2_0/mp3-index-x.gif);
    background-repeat:repeat-x
    }
    .nav-lrou,.nav-rrou,.main-nav li,.main-nav .on a,.main-nav li a i,.mp3-index .main-nav li.home a,.rank .main-nav li.rank a,.singer .main-nav li.singer a,.music-cate .main-nav li.music-cate a,.zhangmen .main-nav li.zhangmen a,.topics-list-wrap,.play,.btn,.up,.down,.btn span,.champion-ico,.dividing-line,.secon-nav li a,.secon-nav li a i,.status-new,.search-btn,.top-list .special-line,.hot-tags-list-wrap,.hot,.new,.new1,.winners-list li,.opera-data-list,.ting-singer-ico{
    background-image:url(http://static.mp3.baidu.com/imgs/bXAzaW5kZXg-/v2_0/mp3-global-png.png?ver=20110810);
    background-repeat:no-repeat
    }
    .loading{
    display:inline-block;
    vertical-align:middle;
    width:16px;
    height:16px;
    overflow:hidden;
    font-size:0;
    line-height:0;
    -webkit-text-size-adjust:none;
    background:url(http://static.mp3.baidu.com/imgs/bXAzaW5kZXg-/v2_0/loading.gif) no-repeat
    }
    .play-btn{
    position:relative;
    display:inline-block;
    width:21px;
    height:60px;
    background:url(http://static.mp3.baidu.com/imgs/bXAzaW5kZXg-/v2_0/play-btn-png.png) no-repeat;
    _background:0;
    _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='corp',src='http://static.mp3.baidu.com/imgs/bXAzaW5kZXg-/v2_0/play-btn-png.png')
    }
    .hot,.new{
    display:inline-block;
    width:19px;
    height:15px;
    overflow:hidden;
    text-indent:-999px;
    background-position:0 -140px
    }
    .new1{
    display:inline-block;
    width:22px;
    height:12px;
    overflow:hidden;
    text-indent:-9999px;
    background-position:-40px -160px
    }
    .hot{
    background-position:-25px -140px
    }
    .play{
    padding-left:21px;
    background-position:-115px -141px
    }
    .play-ico{
    float:left;
    width:21px;
    height:19px;
    margin-top:-1px;
    background:url(http://static.mp3.baidu.com/imgs/bXAzaW5kZXg-/v2_0/play-png.png) no-repeat;
    _background:0;
    _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='corp',src='http://static.mp3.baidu.com/imgs/bXAzaW5kZXg-/v2_0/play-png.png');
    cursor:pointer
    }
    .btn{
    display:inline-block;
    height:22px;
    padding-left:6px;
    margin-right:6px;
    background-position:0 -35px;
    line-height:21px;
    line-height:22px;
    font-size:12px;
    color:#000;
    text-decoration:none;
    cursor:pointer;
    white-space:nowrap;
    vertical-align:middle;
    font-family:b8bf53
    }
    .btn span{
    position:relative;
    float:left;
    margin-right:-1px;
    padding-right:6px;
    background-position:100% -35px
    }
    .btn:hover{
    color:#000;
    zoom:1
    }
    .btn:hover span{
    text-decoration:underline
    }
    .champion-ico{
    display:none
    }
    .dividing-line{
    height:1px;
    margin:0 10px;
    overflow:hidden;
    background-position:0 -200px;
    background-repeat:repeat-x
    }
    .up,.down{
    display:block;
    width:7px;
    height:7px;
    overflow:hidden;
    background-position:-80px -140px;
    text-indent:-9999px
    }
    .down{
    background-position:-80px -150px
    }
    .stability{
    display:block;
    width:7px;
    height:3px;
    border-bottom:2px solid #666;
    overflow:hidden;
    text-indent:-9999px
    }
    .status-new{
    display:block;
    width:9px;
    height:9px;
    overflow:hidden;
    background-position:-70px -140px;
    text-indent:-9999px
    }
    .search-btn{
    display:block;
    width:16px;
    height:16px;
    overflow:hidden;
    background-position:-90px -140px;
    text-indent:-9999px
    }
    .first-release{
    width:33px;
    height:33px;
    background:url(http://static.mp3.baidu.com/imgs/bXAzaW5kZXg-/v2_0/first-release-png.png) no-repeat;
    _background:0;
    _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='corp',src='http://static.mp3.baidu.com/imgs/bXAzaW5kZXg-/v2_0/first-release-png.png');
    text-indent:-99em;
    overflow:hidden
    }
    .ting-singer-ico{
    display:inline-block;
    width:16px;
    height:16px;
    margin-left:2px;
    overflow:hidden;
    vertical-align:middle;
    text-indent:-99em;
    background-position:-70px -160px
    }
    .ting-singer-ico:hover{
    background-position:-90px -160px
    }
    .wp{
    width:980px;
    margin:0 auto
    }
    .user-bar{
    position:absolute;
    top:0;
    right:0;
    padding:8px 10px 0 0;
    font-size:12px
    }
    .hd{
    height:80px;
    padding:26px 0 0 0
    }
    .lg{
    float:left;
    width:147px;
    height:62px;
    padding-top:7px
    }
    .search-wrap{
    float:left
    }
    .lk{
    padding-bottom:8px;
    font-size:14px
    }
    .lk a,.lk span{
    margin-right:12px
    }
    .lk span{
    font-weight:bold
    }
    .search{
    position:relative;
    z-index:10
    }
    .search span{
    font-size:12px
    }
    .search td{
    padding:2px
    }
    .kw{
    width:358px;
    margin:0 3px 0 0;
    padding:3px 1px;
    vertical-align:middle;
    font-family:Arial;
    font-size:16px
    }
    .su{
    width:78px;
    height:28px;
    margin:0 7px 0 0;
    line-height:24px;
    vertical-align:middle;
    font-size:14px
    }
    .cate{
    font-size:12px
    }
    #search{
    padding:20px 0 13px;
    height:auto
    }
    #search{
    width:850px;
    font:12px arial
    }
    #search .lg{
    width:auto;
    height:auto;
    padding-right:15px
    }
    #search a{
    color:#00c
    }
    #search form{
    margin:0;
    clear:both;
    position:relative;
    z-index:0
    }
    #search .s_btn_wr input,#search .s_ipt_wr input{
    padding:0;
    border:0
    }
    #search label{
    margin-right:15px;
    *margin-right:9px
    }
    #search label input{
    margin-left:0;
    margin-top:4px;
    margin-top:1px9
    }
    #search-type{
    margin-left:-4px9
    }
    #search .s_nav{
    height:45px
    }
    #search .s_nav .s_logo{
    margin-right:20px;
    float:left
    }
    #search .s_nav .s_logo img{
    border:0;
    display:block
    }
    #search .s_nav .s_tab{
    line-height:18px;
    padding:20px 0 0;
    float:left
    }
    #search .s_nav a{
    font-size:14px
    }
    #search .s_nav b{
    font-size:14px
    }
    #search .s_ipt_wr{
    width:408px;
    height:30px;
    display:inline-block;
    margin-right:5px;
    background:url(http://imgs.zhangmen.baidu.com/sug/bg_search.png) no-repeat -304px 0;
    border:1px solid #b6b6b6;
    border-color:#7b7b7b #b6b6b6 #b6b6b6 #7b7b7b;
    vertical-align:top
    }
    #search .s_ipt{
    width:395px;
    height:22px;
    font:16px/22px arial;
    margin:5px 0 0 7px;
    background:#fff;
    outline:0
    }
    #search .s_btn{
    width:95px;
    height:32px;
    padding-top:2px9;
    font-size:14px;
    background:#ddd url(http://imgs.zhangmen.baidu.com/sug/bg_search.png);
    cursor:pointer
    }
    #search .s_btn_h{
    background-position:-100px 0
    }
    #search .s_btn_wr{
    width:97px;
    height:34px;
    display:inline-block;
    background:url(http://imgs.zhangmen.baidu.com/sug/bg_search.png) no-repeat -202px 0;
    *position:relative;
    z-index:0;
    vertical-align:top
    }
    #search .s_tools{
    color:#999;
    padding:8px 0 0 14px;
    display:inline-block
    }
    #search .s_tools a{
    margin:0 8px;
    zoom:1
    }
    .tangram-suggestion{
    cursor:default;
    width:408px;
    position:absolute;
    background:#fff;
    border:1px solid #817f82;
    overflow:hidden
    }
    .tangram-suggestion table{
    cursor:default;
    width:100%;
    font-size:14px
    }
    .tangram-suggestion td{
    font:14px arial;
    height:25px;
    line-height:25px;
    padding:0 8px;
    font-weight:700
    }
    .tangram-suggestion td b{
    color:#333;
    font-weight:400
    }
    .tangram-suggestion-current{
    background:#ebebeb
    }
    .tangram-suggestion-prepend{
    padding:0;
    color:#c0c0c0;
    font:12px verdana
    }
    .tangram-suggestion-append{
    height:23px;
    line-height:23px;
    text-align:right;
    border-top:1px solid #ebebeb;
    padding:0 8px;
    color:#c0c0c0;
    font:12px verdana;
    text-align:right
    }
    .tangram-suggestion-append a{
    font-size:12px;
    text-decoration:underline;
    color:#888;
    line-height:22px
    }
    .img{
    border-bottom:1px solid #eee
    }
    .img img{
    display:block;
    padding:3px;
    border:1px solid #ccc;
    background:#eee
    }
    .nav,.sub-nav,.sub-nav-wrap i,.sub-nav-wrap b{
    background-image:url(http://static.mp3.baidu.com/imgs/bXAzaW5kZXg-/v2_0/mp3-index-x.gif);
    background-repeat:repeat-x
    }
    .nav{
    position:relative;
    height:33px;
    margin-bottom:10px;
    background-color:#608be3
    }
    .nav-lrou,.nav-rrou{
    float:left;
    width:2px;
    height:33px
    }
    .nav-rrou{
    float:right;
    background-position:-5px 0
    }
    .nav .feedback{
    display:none;
    position:absolute;
    top:-30px;
    right:-7px;
    color:#ccc;
    font-size:12px
    }
      

  11.   

    具体还是您自己写吧:1、创建一个DIV容器,在样式表中设置大小和字体、行(li)样式,并设置DIV绝对定位于输入框左下角,设置它的display为隐藏。
    2、栏目列表中缺省设置“网页”被选中,其样式为选中样式,并让“网页”作为方法getPrompt的参数一,然后侦听文本框事件,获得了焦点且键盘onkeyup,就读取文本框输入的字符作为方法getPrompt的参数二;然后调用方法方法getPrompt;在回调函数中,回调成功后,返回的“info”为一个数组,可以:var str = "<ul><li>" + info.join("</li><li>")+"<li></ul>",再设置第一步创建的DIV容器的display为显示并把str字符串innerHTML进去。
    4、侦听文本框失去了焦点,就清空DIV容器中的内容(innerHTML = ""),并把它的display属性设置为隐藏。
      

  12.   

    5、给栏目列表委托绑定一个onclick事件,被点击元素样式设置为选中样式,其余为非选中样式,被点击元素的innerHTML作为方法getPrompt的参数二。