例如,我在网页a.html中加了一iframe b.html .
在b.html 中我写了段:

程序代码
<style>
.abc{color:#000000}
</style>
现在我想在a.html中写段javascript去改变b.html中.abc的色彩。方法如下:

程序代码
document.frames['content'].document.styleSheets[0].addRule(".abc","color:#FF0000");
其中:
content为iframe的name和id .
例如:

程序代码
<iframe src="b.html" name="content" height="15" width="468" scrolling="no" id="content" frameborder="0"></iframe>