繁体   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