久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <small id='XxqAS'></small><noframes id='XxqAS'>

      <legend id='XxqAS'><style id='XxqAS'><dir id='XxqAS'><q id='XxqAS'></q></dir></style></legend>

      <tfoot id='XxqAS'></tfoot>
      <i id='XxqAS'><tr id='XxqAS'><dt id='XxqAS'><q id='XxqAS'><span id='XxqAS'><b id='XxqAS'><form id='XxqAS'><ins id='XxqAS'></ins><ul id='XxqAS'></ul><sub id='XxqAS'></sub></form><legend id='XxqAS'></legend><bdo id='XxqAS'><pre id='XxqAS'><center id='XxqAS'></center></pre></bdo></b><th id='XxqAS'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='XxqAS'><tfoot id='XxqAS'></tfoot><dl id='XxqAS'><fieldset id='XxqAS'></fieldset></dl></div>

        • <bdo id='XxqAS'></bdo><ul id='XxqAS'></ul>

        從 responseText 中獲取特定內容

        Get specific content off responseText(從 responseText 中獲取特定內容)
        1. <tfoot id='nl0Hp'></tfoot>

            • <bdo id='nl0Hp'></bdo><ul id='nl0Hp'></ul>
                <tbody id='nl0Hp'></tbody>

                • <legend id='nl0Hp'><style id='nl0Hp'><dir id='nl0Hp'><q id='nl0Hp'></q></dir></style></legend>

                  <small id='nl0Hp'></small><noframes id='nl0Hp'>

                • <i id='nl0Hp'><tr id='nl0Hp'><dt id='nl0Hp'><q id='nl0Hp'><span id='nl0Hp'><b id='nl0Hp'><form id='nl0Hp'><ins id='nl0Hp'></ins><ul id='nl0Hp'></ul><sub id='nl0Hp'></sub></form><legend id='nl0Hp'></legend><bdo id='nl0Hp'><pre id='nl0Hp'><center id='nl0Hp'></center></pre></bdo></b><th id='nl0Hp'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='nl0Hp'><tfoot id='nl0Hp'></tfoot><dl id='nl0Hp'><fieldset id='nl0Hp'></fieldset></dl></div>

                  本文介紹了從 responseText 中獲取特定內容的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在進行 ajax 調用,并從 responseText 獲取內容.

                  我通過使用 alert 確認,responseText 包含整個頁面作為 string.

                  沒關系.現在我需要通過將字符串轉換為 DOM 并使用 getElementsByTagNamegetElementsByName 等從字符串中提取特定內容...

                  我的問題是這些似乎都不起作用.

                  我已經閱讀了很多關于使用 responseXML 而不是 responseText 的參考資料,但這讓我返回了 null.

                  那么,堅持responseText,我怎樣才能得到我想要的特定元素呢?

                  例如,如果我的回復包含以下內容:

                  <html><head>....</head><身體>..........<桌子><tr><td>一些文本</td><td>其他文本</td></tr><tr><td>一些文本</td><td>其他文本</td></tr><tr><td>一些文本</td><td>其他文本</td></tr></表>

                  somediv </div></身體></html>

                  如何訪問表格的第二行及其值?或 div 等.所以,現在在我的實際 html 中,我有這樣的東西

                  <html><頭>.....</頭><身體><table><tr><td id="test">Test</td></tr></table></身體></html>

                  我希望在我的實際 html 的表中解析提取的元素/值..

                  document.getElementById('test').innerHTML = the_extracted_elements_from_responseText

                  解決方案

                  您需要在 html 上使用 DOMParser 并在結果文檔上使用 DOM 遍歷方法以返回所需的節點.

                   var parser=new DOMParser();var xmlDoc=parser.parseFromString(responseText,"text/xml");var tds = xmlDoc.getElementsByTagName("td");

                  請注意,IE 將需要 new ActiveXObject("Microsoft.XMLDOM");.

                  I am making an ajax call and I get the content from responseText.

                  I confirm by using alert that inside, the responseText contains the entire page as a string.

                  That's fine. Now I need to extract specific contents from the string by converting it to DOM and using getElementsByTagName, getElementsByName etc...

                  My problem is that none of these seems to work.

                  I've read many references on using responseXML instead of responseText but this gives me back null.

                  So, by sticking to responseText, how can i get the specific elements that I want?

                  For instance if my response contains the following:

                  <html>
                  <head>....</head>
                  <body>....
                   .....
                   <table>
                   <tr>
                   <td>sometext</td>
                   <td>someothertext</td>
                   </tr>
                   <tr>
                   <td>sometext</td>
                   <td>someothertext</td>
                   </tr>
                   <tr>
                   <td>sometext</td>
                   <td>someothertext</td>
                   </tr>    
                   </table> 
                   <div> somediv </div>
                   </body>
                   </html>     
                  

                  how can I access the second row of the table and its value? Or the div etc.. so, now in my actual html, i have sth like this

                  <html>
                  <head>.....</head>
                  <body>
                  <table><tr><td id="test">Test</td></tr></table>
                  </body>
                  </html>
                  

                  i want the extracted element/value to be parsed inside the table of my actual html..

                  document.getElementById('test').innerHTML = the_extracted_elements_from_responseText

                  解決方案

                  You need to use a DOMParser on the html and use DOM traversal methods on the resulting document to return the desired node(s).

                    var parser=new DOMParser();
                    var xmlDoc=parser.parseFromString(responseText,"text/xml");
                    var tds = xmlDoc.getElementsByTagName("td");
                  

                  Note that IE would require new ActiveXObject("Microsoft.XMLDOM"); instead.

                  這篇關于從 responseText 中獲取特定內容的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                  JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                  XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                  NETWORK_ERROR: XMLHttpRequest Exception 101(NETWORK_ERROR:XMLHttpRequest 異常 101)
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)

                    <i id='yWgUy'><tr id='yWgUy'><dt id='yWgUy'><q id='yWgUy'><span id='yWgUy'><b id='yWgUy'><form id='yWgUy'><ins id='yWgUy'></ins><ul id='yWgUy'></ul><sub id='yWgUy'></sub></form><legend id='yWgUy'></legend><bdo id='yWgUy'><pre id='yWgUy'><center id='yWgUy'></center></pre></bdo></b><th id='yWgUy'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='yWgUy'><tfoot id='yWgUy'></tfoot><dl id='yWgUy'><fieldset id='yWgUy'></fieldset></dl></div>
                    1. <tfoot id='yWgUy'></tfoot>

                          <tbody id='yWgUy'></tbody>

                          <small id='yWgUy'></small><noframes id='yWgUy'>

                            <bdo id='yWgUy'></bdo><ul id='yWgUy'></ul>
                            <legend id='yWgUy'><style id='yWgUy'><dir id='yWgUy'><q id='yWgUy'></q></dir></style></legend>

                          • 主站蜘蛛池模板: 国产日韩欧美激情 | a黄毛片 | 国产精品一二三区在线观看 | 男人的天堂视频网站 | 久久精品国产久精国产 | 亚洲精品久 | 国产精品99久久久久久宅男 | 在线播放一区二区三区 | 国产一区二区三区在线观看免费 | 欧美精品电影一区 | 午夜一区二区三区 | 欧美性高潮| 国产免费拔擦拔擦8x高清 | 国产亚洲精品久久久久久牛牛 | 99免费在线观看 | 黑人中文字幕一区二区三区 | 自拍视频在线观看 | 国产精品久久久久久久久免费相片 | 亚洲免费在线 | 一级片子 | 99免费在线观看视频 | 亚洲精品1区| 精品一区二区三区中文字幕 | 精品亚洲一区二区三区 | 国产亚洲一区二区三区在线观看 | 欧美一区二区三区日韩 | 亚洲精品乱码久久久久久按摩 | 999久久久精品 | 亚洲精品2| 国产一区二区三区在线看 | 做a视频 | 全免一级毛片 | 亚洲综合色网 | 亚洲品质自拍视频 | www.黄色网| 精品产国自在拍 | 亚洲一级黄色 | 日韩无 | 久久久久av| 免费观看色 | 国内精品成人 |