html中iframe的过滤问题

来源:百度知道 编辑:UC知道 时间:2024/05/12 07:22:17
网页A,网页B
网页B iframe了网页A,但网页A上同时有内容1,内容2,内容3
现在我只想让iframe过来的网页A在网页B上只显示内容2,iframe有没有参数可以办到?
如果不行的话,有没有其他方法可以办到?
注意!!! 网页B我没有任何权限改动.
不要乱复制别人的答案,我都看过了.混分儿的滚蛋

可以的。
你可以在A中编写Javascript脚本
top.***可以得到B的一些属性。比如top.location 可以得到地址
你可以写一个判断语句,根据不同的条件document.write()出不同的内容。

a.htm
<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>页面A</title></head>
<body>
<div id="p1">内容1</div>
<div id="p2">内容1</div>
<div id="p3">内容1</div>
</body>
</html>
<script language="javascript" type="text/javascript">
if(top.location.toString().indexOf('a.htm')== -1){
p1.style.display = 'none';
p3.style.display = 'none';
}
</script>

b.htm //仅供实验。
<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>页面B</title></head>
<body><i