[英]Using getElementById method to find an element inside an iFrame
so I have an iframe: 所以我有一个iframe:
<iframe id="CPHNavBar_TBDC081D1008_frameSticky" src="/stickyserviceavailabilitycheck"></iframe>
and I need to reference a piece of css code that lives on the src portion above. 我需要引用驻留在上面src部分中的一段CSS代码。 This code will select it when on the src page: 在src页面上,此代码将选择它:
document.getElementById( "ContentPlaceHolder1_C001_btnSMBAddressCheckYes");
Is it possible to reference the css element from page with the 是否可以通过页面引用css元素
<iframe id="CPHNavBar_TBDC081D1008_frameSticky" src="/stickyserviceavailabilitycheck"></iframe>
hosted on it? 托管吗?
Due to the Same Origin Policy , if two pages do not share a domain name and port number, one page cannot edit the DOM, or run JS on the other page. 由于同源策略相同 ,如果两个页面不共享域名和端口号,则一个页面无法编辑DOM或在另一页面上运行JS。 (Usually attempted via the <iframe>
element). (通常尝试通过<iframe>
元素)。 The same origin policy also applies to XMLHttpRequest. 相同的原始策略也适用于XMLHttpRequest。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.