这个要自己写,
返回一个xml

解决方案 »

  1.   

    关键是那个XML从哪个URL得回,我看了半天代码没找着那个得到数据的URL,希望高手指点一下。
      

  2.   

    关键是那个  wz() 函数再源文件中找不到
    其实是被编码掉了源:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>东莞交通违章查询 | 东莞汽车违章查询 DG0769.COM</title>
    <meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
    <meta name="Author" content="BoBo">
    <meta name="Description" content="东莞交通违章查询,东莞车辆违章查询,提供免费的东莞汽车违章查询" />
    <meta name="Keywords" content="东莞,东莞违章,东莞汽车,车辆,交通,违章查询" />
    <script language="javascript" type="text/javascript" src="ajax.js"></script>
    <style type="text/css"> 
    body {
    margin: 0;
    text-align: center;
    font-size: 12px;
    color: #000;
    background: #fff;
    }td {
    font-size: 12px;
    }.input_text {
    background: #fff;
    border: 1px solid #fff;
    border-bottom: 1px solid #999;
    margin-right: 4px;
    }a:link,a:visited {
    color: #000000;
    text-decoration: none;
    }a:hover {
    color: #0000FF;
    text-decoration: none;
    }.bd {
    width:760px;
    margin:auto;
    margin-bottom:1em;
    text-align:left;
    }.top {
    line-height:20px;
    background-color:#f3f3f3;
    border-bottom:1px solid #e3e3e3;
    color:#0E4DBF;
    }
    </style><Script Language="JavaScript">
    eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('7 2(){$("0").8="";3=9($6("1"));4 5=a e("0","0.f","g","b=2&1="+3,"c","d")}',17,17,'search|carno|wz|carobj|var|myajax|F|function|innerHTML|escape|new|action|loading|true|updater|asp|get'.split('|'),0,{}))
    </Script>
    <Script Language="JavaScript">
    eval(
    function(p,a,c,k,e,d)
    {
    e=function(c)
    {
    return(c<a?"":e(parseInt(c/a)))  +  (         (c=c%a)>35?String.fromCharCode(c+29):c.toString(36)             )
    };
    if(         !''.replace(/^/,String)            )
    {
    while(c--)
    d[e(c)]=k[c]  ||   e(c);
    k=[                     function(e)
    {
    return d[e]}];
    e=function(){return'\\w+'};
    c=1;};

    while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('7 2(){$("0").8="";3=9($6("1"));4 5=a e("0","0.f","g","b=2&1="+3,"c","d")}',17,17,'search|carno|wz|carobj|var|myajax|F|function|innerHTML|escape|new|action|loading|true|updater|asp|get'.split('|'),0,{}))
    </Script></head><body><table width="760" height="23" border="0" cellpadding="0" cellspacing="1" class="top">
    <tr> 
    <td width="10"></td>
    <td width="500">
    <a href="http://weather.dg0769.com" target="_blank">东莞天气</a> | <a href="http://www.dghome.com/" target="_blank">东莞二手房</a> | <a href="/firefox/index.htm" target="_blank">FireFox浏览器</a> | <a href="javascript:window.external.AddFavorite('http://dg0769.com', '东莞违章')">收藏本站</a>
    </td>
    <td align="right" width="240"><a href="http://weather.dg0769.com" title="点击查看详细东莞天气" target="_blank">东莞 
     <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" align="absbottom" width="22" height="22">
     <param name="movie" value="/weather/images/w3.swf" />
     <param name="quality" value="high" />
     <embed src="/weather/images/w3.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" align="absbottom" width="22" height="22"></embed>
     </object>多云转阵雨
    34℃ / 25℃</a></td>
    <td width="10"></td>
    </tr>
    </table><br />
    <table width="760" border="0" cellpadding="4" cellspacing="0" bgcolor="#ffffff" style="border-left: 1px solid #79a7e2; border-right: 1px solid #79a7e2; border-top: 1px solid #79a7e2; border-bottom: 1px solid #79a7e2;">
    <tr>
    <td height="23" bgcolor="#eff5ff">
    <strong>东莞交通违章查询</strong> | 数据更新日期:2007.06.29
    </td>
    <td bgcolor="#eff5ff" align="right">
    东莞动感0769 DG0769.COM
    </td>
    </tr>
    <tr>
    <td width="292" style="line-height:25px;">
    <br>
    车牌号码:
    <input type="text" name="carno" id="carno" size="16" value="粤S" class="input_text" />
    &nbsp;
    <input type="button" value="提交" onClick="wz()" />
    <br>
    <a href="carcode.html" target="_blank"><font color="blue">交通违章处罚一览表</font></a>
    </td>
    <td width="468">
    <span id="gg_01">数据载入中...</span>
    </td>
    </tr>
    </table>
    <div id="loading" style="display:none;"><br /><img src="ajax-loader.gif" width="16" height="16" align="absmiddle" /> 正在查询,请稍候....</div>
    <div id="search" style="width:760px;"></div>
    <p align="center">
    东莞交通违章查询 - 东莞动感0769 DG0769.COM 为您免费提供最新、最全、最准确的东莞汽车违章信息查询
    <br />
    <a href="http://www.miibeian.gov.cn" target="_blank">粤ICP备05001538号</a>
    <br />
    </p>
    <div style="display:none;"><script language="javascript" type="text/javascript" src="http://js.users.51.la/313735.js"></script>
    <noscript><a href="http://www.51.la/?313735" target="_blank"><img alt="&#x6211;&#x8981;&#x5566;&#x514D;&#x8D39;&#x7EDF;&#x8BA1;" src="http://img.users.51.la/313735.asp" style="border:none" /></a></noscript></div><span id="span_gg_01">
    <script type="text/javascript"><!--
    google_ad_client = "pub-0518939646122332";
    google_ad_width = 468;
    google_ad_height = 60;
    google_ad_format = "468x60_as";
    google_ad_type = "text_image";
    //2007-06-27: 违章
    google_ad_channel = "5698317547";
    google_ui_features = "rc:0";
    //-->
    </script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    </span>
    <script>
    gg_01.innerHTML=span_gg_01.innerHTML;
    span_gg_01.innerHTML="";
    </script>
    </body>
    </html>其中有这么一段js代码(是编码后的)
    <Script Language="JavaScript">
    eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('7 2(){$("0").8="";3=9($6("1"));4 5=a e("0","0.f","g","b=2&1="+3,"c","d")}',17,17,'search|carno|wz|carobj|var|myajax|F|function|innerHTML|escape|new|action|loading|true|updater|asp|get'.split('|'),0,{}))
    </Script>
    将其编码后变成:
    function wz(){$("search").innerHTML="";carobj=escape($F("carno"));var myajax=new updater("search","search.asp","get","action=wz&carno="+carobj,"loading","true")}wz() 函数就出来了然后对照源文件中包含的ajax.js文件去看就行了下面是ajax。js文件
      

  3.   

    //ajax.js
    function $(objID) {
      return document.getElementById(objID)
    }function $F(objID) {
      return document.getElementById(objID).value
    }var XMLHttp=function(){
    try {return new ActiveXObject("Msxml5.XMLHTTP");}catch(e){}
    try {return new ActiveXObject("Msxml4.XMLHTTP");}catch(e){}
    try {return new ActiveXObject("Msxml3.XMLHTTP");}catch(e){}
    try {return new ActiveXObject("Msxml2.XMLHTTP");}catch(e){}
    try {return new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}
    try {return new XMLHttpRequest();}catch(e){}
    return null;
    }function request(url,method,parameters,loading,callback,async){
    var req=new XMLHttp();
    var url=url;
    var method=method;
    var parameters=parameters;
    var loading=loading;
    var callback=callback;
    var async=async;
    if (req!=null){
    req.onreadystatechange = function(){
    if (req.readyState==4){
    if(req.status==200){
    window.status=""
    $(loading).style.display="none";
    callback(req);
    }else{
    window.status="服务器出错,错误代码:"+req.statusText
    }
    }else{
     window.status="正在加载......"
     $(loading).style.display="block";
    }
    }
    if (parameters=="") url=url;
    else url+="?"+parameters;
    url+=(url.indexOf("?") >= 0)?"&nowtime="+new Date().getTime():"?nowtime=" + new Date().getTime();
    if (method=='get'){
    req.open('GET',url,async);
    req.send(null);
    }else if (method=='post'){
    req.open('POST',url,async);
    req.setRequestHeader("Content-Length",parameters.length); 
    req.setRequestHeader('Content-Type','application/x-www-form-urlencoded;charset=GB2312');
    req.send(parameters);
    }else{
        window.status="请至少使用一种传送方式";
    }
    }else{
    window.status="无法创建xmlhttp";
    }
    }function updater(objid,url,method,parameters,loading,async){
    var req=new XMLHttp();
    var objid=objid;
    var url=url;
    var method=method;
    var parameters=parameters;
    var loading=loading;
    var async=async;
    if (req!=null){
    req.onreadystatechange = function(){
    if (req.readyState==4){
    if(req.status==200){
    window.status=""
    $(loading).style.display="none";
    $(objid).innerHTML=req.responseText;
    }else{
    window.status="服务器出错,错误代码:"+req.statusText
    }
    }else{
     window.status="正在加载......"
     $(loading).style.display="block";
    }
    }
    if (parameters=="") url=url;
    else url+="?"+parameters;
    url+=(url.indexOf("?") >= 0)?"&nowtime="+new Date().getTime():"?nowtime=" + new Date().getTime();
    if (method=='get'){
    req.open('GET',url,async);
    req.send(null);
    }else if (method=='post'){
    req.open('POST',url,async);
    req.setRequestHeader("Content-Length",parameters.length); 
    req.setRequestHeader('Content-Type','application/x-www-form-urlencoded;charset=GB2312');
    req.send(parameters);
    }else{
        window.status="请至少使用一种传送方式";
    }
    }else{
    window.status="无法创建xmlhttp";
    }
    }
      

  4.   

    我试试看,看怎么个搞法,我也试过把那个AJAX.js下载下来,但是加载得到相应的XML时出现异常。