谁知道114la的 网址快搜 功能和内页风格关联怎么做的?程序实例代码更好。

解决方案 »

  1.   

    查询网站需要用到ajax,这里只有个输入框的效果
    a.css.divstyle{
    background:yellow;
    }b.css.divstyle{
    background:blue;
    }
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
     <head>
      <title> New Document </title>
      <link id="divstyle" type="text/css" rel="stylesheet" href="a.css" />
      <style type="text/css">
    .divstyle{
    height:200px;
    width:200px;
    }
    .divyellow,.divblue{
    float:left;
    height: 20px;
    width: 20px;
    }
    .divyellow{
    background:yellow;
    }
    .divblue{
    background:blue;
    }
      </style>
     </head>
     <body>
    <div>
    <div class="divyellow" onclick="document.getElementById('divstyle').href='a.css'"></div>
    <div class="divblue" onclick="document.getElementById('divstyle').href='b.css'"></div>
    </div>
    <br />
    <div class="divstyle"></div>
    <br /> <input type="text" value="请输入网站名或拼音" onmouseover="changeText(this);" onblur="resetText(this)"/>
    <script type="text/javascript">
    function changeText(txt){
    if(txt.value == "请输入网站名或拼音"){
    txt.value="";
    txt.focus();
    }
    }
    function resetText(txt){
    if(txt.value.length==0){
    txt.value="请输入网站名或拼音";
    txt.blur();
    }
    }
    </script>
     </body>
    </html>
      

  2.   

    3Q,需要ajax处理程序的详细代码。
      

  3.   

    一个简单的示例<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <body><script type="text/javascript">function ajaxFunction()
    {
        var xmlHttp;
        try{
            // Firefox, Opera 8.0+, Safari
            xmlHttp=new XMLHttpRequest();
        }
        catch (e){
            // Internet Explorer
            try{
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
            } 
            catch (e){
                try{
                    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch (e){
                    alert("您的浏览器不支持AJAX!");
                    return false;
                }
            }
        }
        xmlHttp.onreadystatechange=function(){
            if(xmlHttp.readyState==4){
                document.getElementById("data").innerHTML=xmlHttp.responseText;
                alert("加载完成!");
            }
        }
        xmlHttp.open("GET","http://www.baidu.com",true);
        xmlHttp.send(null);
    }
    </script>
    <div id="data"></div>
    <input type="button" value="get"  onclick="ajaxFunction();" />
    </body>
    </html>