Get HTML inside iframe using jQuery

后端 未结 10 1185
清歌不尽
清歌不尽 2020-11-27 04:24

Here is my situation.

I have a file called iframe.html, which contains the code to for a image slideshow. The code is somewhat like

<         


        
10条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 05:02

    this works for me because it works fine in ie8.

    $('#iframe').contents().find("html").html();
    

    but if you like to use javascript aside for jquery you may use like this

    var iframe = document.getElementById('iframecontent');
    var innerDoc = iframe.contentDocument || iframe.contentWindow.document;
    var val_1 = innerDoc.getElementById('value_1').value;
    

提交回复
热议问题