我试图将外部页面加载到 iframe 中,并更改该页面的背景颜色。以下是代码(它不能正常工作 - 它会更改父级页面而不是 iframe 页面的颜色):
<style type="text/css">
iframe {
background-color: #F00;
}
</style>
<iframe src="http://www.filehippo.com/" height="100%" width="100%">
</iframe>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('body').css('background-color', '#F00');
});
</script>