这个好办1.htm母窗口代码:
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title><script language=javascript>
function gogo()
{
document.frames["f"].document.styleSheets.mycss.addRule("P","color:green");
}
</script>
</head><body>
<iframe id="f" src=2.htm></iframe>
<p><input type="button" value="按钮" name="B3" onclick="gogo();"></p>
</body></html>2.htm iframe引用的网页代码:
<html><head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
<style id="mycss" type=text/css>
p {color:red}
</style>
</head><body><p>22222222</p>
<p>22222222222</p>
<p>22222222222</p></body></html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title><script language=javascript>
function gogo()
{
document.frames["f"].document.styleSheets.mycss.addRule("P","color:green");
}
</script>
</head><body>
<iframe id="f" src=2.htm></iframe>
<p><input type="button" value="按钮" name="B3" onclick="gogo();"></p>
</body></html>2.htm iframe引用的网页代码:
<html><head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
<style id="mycss" type=text/css>
p {color:red}
</style>
</head><body><p>22222222</p>
<p>22222222222</p>
<p>22222222222</p></body></html>
function gogo()
{
document.frames["f"].document.styleSheets[0].addRule("P","color:green");
}
如果不用按钮事件,如何直接让父页面打开就给子页面加载CSS呢?
1 论坛的调用代码是:<iframe scrolling="yes" id="ct_iframe" src="http://bbs.wlkj.net/sviewnews.php?minv=显示最近X个帖子" onload="this.height = this.document.body.offsetHeight;this.width=this.document.body.offsetWidth;"></iframe>2 还用到了读吧的调用是:<iframe scrolling="yes" id="l1t_iframe" src=http://book.wlkj.net/dataquote.php?kind=bookhit></iframe>不知道这种类型的调用能不能够实现加载CSS样式?
另外,我把上面两个调用的数据显示页面单独下载到本机也不能实现加载样式。
(有网站的管理权限)