How to Control CSS in IFRAME outside IFRAME?
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< Html Xmlns = "Http://www.w3.org/1999/xhtml" Lang = "ZH-CN" >
< Head >
< Meta HTTP-equiv = "Content-Type" Content = "Text/html; charset = gb2312" />
< Title > </ Title >
</ Head >
< Body >
< IFRAME ID = "FF" SRC = "B .htm" > </ IFRAME >
< Input Type = "Submit" Value = "OK" Onclick = "OK ()" />
< Script Language = "JavaScript" >
Function OK ()
{
// Operate CSS in IFRAME
VaR IFRAME = Document. getelementbyidx ( ' FF ' );
VaR Body = Iframe.contentdomaindoc ument. Body;
Body. style. margintop = 50 ;
Body. style. padding = 0 ;
Body. style. fontsize = 30 ;
Body. style. textalign = ' Center ' ;
Body. style. backgroundcolor = ' Red ' ;
Body. style. Color = ' Blue ' ;
}
</ Script >
</ Body >
</ Html >
This is feasible, provided that the IFRAME is in the same domain as your page. If var IFRAME = Document. getelementbyid ('ff ') is cross-domain, the error "no access permission" is returned ".
the question is how to modify the style in the IFRAME for cross-origin .. To be resolved ..