[英]How to get an element outside of iframe with javascript or jQuery?
I'm trying to get a element from outside of iframe with js or jQuery. 我试图用js或jQuery从iframe外部获取一个元素。 I found something but it's not cross browser.
我找到了一些东西,但它不是跨浏览器。
<div id=vi-desc-maincntr"">
<div class="u-flL iti-act-num">123456789</div>
<div id="desc_div">
<iframe src="LOCATION">
</div>
</div>
I need that number into a variable. 我需要将该数字转换为变量。
Same-origin policy : 同源政策 :
You might want to check this. 你可能想检查一下。 Two pages need to have the same origin.
两页需要具有相同的原点。
https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy
jQuery( selector [, context ] )
The second parameter provides the context
in which to search the element matched by the first parameter. 第二个参数提供搜索第一个参数匹配的元素的
context
。 The Document is here: http://api.jquery.com/jQuery/#jQuery-selector-context 该文件在此处: http : //api.jquery.com/jQuery/#jQuery-selector-context
jQuery( selector [, context ] )
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.