簡體   English   中英

我必須 iframe 一個父母和另一個孩子,我想使用 jquery 獲得孩子 iframe 的價值,我怎樣才能得到?

[英]i have to iframe one parent and other child, i want to get child iframe value using jquery, how can i get?

這是我的代碼:

<div id="biography_name1">
    <iframe id="Array___Frame" src="some_value" height="600" frameborder="0" width="100%" scrolling="no" >
        <html>
              <head></head>
              <body>
                   <iframe  src="some_value">
                      <div class="my_value"> GET THIS VALUE </div>
                   </iframe> 
              </body>
        </html>
    </iframe> 
</div>

在這里,我想使用 jquery 獲得 class my_value 值。我該怎么做?

如果有幫助,請不要忘記投票並接受答案; ;)

<iframe id='frameParent'>
    <iframe id='frameChild'>
        <div id="my_value">some text here</div>
    </iframe>
</iframe>
<script>
    var foo = $("#frameParent").contents().find("#frameChild").contents().find(".my_value").text();
    //NOW YOUR VALUE IS STORED IN THE VARIABLE CALLED FOO  
    //change '#' to '.' in last find statement      
</script>

現在它應該工作

$(".my_value").text();

會那樣做。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM