2013-09-26 107 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控制檯提供一些截圖。 –

相關問題