2013-09-26 104 views
-1

好吧,我知道这可能听起来像一个重复的问题,因为很多问题已被问到像这样一个......但我已经看过几乎所有的人,并找不到什么解决方案。jquery工作在Firefox但不在铬

好我正在使用一般的Ajax调用服务器如下回应:

<form id="ctl00" name="ctl00" method="post" action="RatesGrids.aspx?pt=EMPL&amp;RT=bill"> 
    <div> 
    <input id="__VIEWSTATE" type="hidden" name="__VIEWSTATE" value="/wEPDwUENTM4MQ9kFgJmD2QWAmYPPCsADQEADxYCHgtfIUl0ZW1Db3VudAICZGQYAQUMZ3JkQmlsbFJhdGVzDzwrAAoBCAIBZE4pvNtSHIbu7h7ISmN42ktJBm5R"> 
    </div> 
    <div> 
     <table id="grdBillRates" class="tableView" cellspacing="0" rules="all" border="1" style="width:100%;border-collapse:collapse;"> 
      <thead> 
      <tr class="tableViewHeader"> 
       <th scope="col" style="white-space:normal;">Emp. Id</th> 
       <th scope="col" style="white-space:normal;">Last Name</th> 
       <th scope="col" style="white-space:normal;">*Res Usage</th> 
       <th scope="col" style="white-space:normal;">Source</th> 
       <th scope="col" style="white-space:normal;">Eff. Date</th> 
       <th scope="col" style="white-space:normal;">*Bill 1</th> 
       <th scope="col" style="white-space:normal;">*Bill 2</th> 
       <th class="display_none" scope="col" style="white-space:normal;"></th> 
       <th class="display_none" scope="col" style="white-space:normal;">Time Stamp</th> 
       <th scope="col" style="white-space:normal;">Currency</th> 
      </tr> 
     </thead> 
     <tbody> 
      <tr class="tableViewRow" onclick="loadrowitems(0,this)" onmouseover="this.style.cursor='default';"> 
        <td style="width:100px;white-space:normal;">10000000034 </td> 
        <td style="width:125px;white-space:normal;">Khan</td> 
        <td style="width:125px;white-space:normal;"></td> 
        <td style="width:80px;white-space:normal;">Local</td> 
        <td style="width:80px;white-space:normal;">12/04/2012</td> 
        <td align="right" style="width:80px;white-space:normal;">3.6500</td> 
        <td align="right" style="width:80px;white-space:normal;">6.0000</td> 
        <td class="display_none" style="width:0px;white-space:normal;">Z-C$ </td> 
        <td class="display_none" style="white-space:normal;">0,0,0,0,1,107,21,255</td> 
        <td style="width:70px;white-space:normal;">Z-C$</td> 
      </tr> 
      <tr class="tableViewAlternatingRow" onclick="loadrowitems(1,this)" onmouseover="this.style.cursor='default';"> 
       <td style="width:100px;white-space:normal;">10000000034 </td> 
       <td style="width:125px;white-space:normal;">Khan</td> 
       <td style="width:125px;white-space:normal;">444 </td> 
       <td style="width:80px;white-space:normal;">Local</td> 
       <td style="width:80px;white-space:normal;">12/04/2012</td> 
       <td align="right" style="width:80px;white-space:normal;">2.1000</td> 
       <td align="right" style="width:80px;white-space:normal;">3.2000</td> 
       <td class="display_none" style="width:0px;white-space:normal;">Z-C$ </td> 
       <td class="display_none" style="white-space:normal;">0,0,0,0,1,107,21,254</td> 
       <td style="width:70px;white-space:normal;">Z-C$</td> 
      </tr> 
     </tbody> 
    </table> 
    </div> 
</form> 

现在我不得不追加表在<div id="grdRates"></div>响应。

我对创建仅保留IE记住使用的应用程序,所以它是使用下面的代码照顾:

if (contents) { 
    var table; 
    if ($(contents).find('table').length > 0) 
     table = $(contents).find('table')[0].xml 
     if (table) { 
      $('#grdRates').parent().show(); 
      $('#grdRates').html(table); 
     } 
} 

上面的代码在Firefox中不能正常工作,以及浏览器,正在给该XML为未定义和从未示出的结果,所以我尝试以下:

if (contents) { 
    var table; 
    if ($(contents).find('table').length > 0) 
     if ($.browser.msie) 
      table = $(contents).find('table')[0].xml 
     else 
      table = $(contents).find('#grdBillRates'); 

     if (table) { 
      $('#grdRates').parent().show(); 
      if ($.browser.msie) 
      $('#grdRates').html(table); 
      else 
      $('#grdRates').html(table.parent().html());  
     } 
    } 
} 

注意#grdBillRates在上述HTML表ID。现在这是在Firefox中工作正常(显示网格很好),但我已经尝试几乎所有的铬,但没有运气....

还有一件事我不能改变DLL,所以解决方案必须使用脚本。任何帮助将不胜感激球员......谢谢

+3

“现在,这不是在Firefox以及Chrome的工作,所以我尝试了以下:”它是如何工作? “现在这在Firefox中工作正常,但我已经尝试了几乎所有的Chrome,但没有运气......”再说一次,它在Chrome中不起作用?如果我们不知道问题是什么,我们如何帮助您解决问题? – Pete

+0

对不起@Pete,我对这个混乱不好......只是编辑了问题......'#grdBillRates'是响应表,我想追加/分配给'#grdRates'的innerHTML ......希望清除它 –

回答

0

是否有任何错误?

你尝试追加它吗?像这样:

if (contents) { 
    var table = $(contents).find('#grdBillRates'); 
    if (table.length > 0) 
     $('#grdRates').parent().show().append(table); 
    } 
} 
+0

不,没有错误,它只是显示我“[object]”而不是表 –

+0

尝试追加'table.html()' – Pete

+0

@Pete,我试了一切,它只是不显示...等等,让我为webkit控制台提供一些截图。 –

相关问题