哈威凯特尔:html中iframe的过滤问题

来源:百度文库 编辑:神马品牌网 时间:2024/04/29 21:35:41
网页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><iframe src="a.htm"></iframe></body></html>

关键是得到网页A上的内容2!!
你可以去 查看---源文件 一下他的源代码
有需要给我消息

看了楼上有些有帖子
终于发现网上有些人的人品.......

唯一的方法就是判断a 是否window==top.如果不是只显示内容2。

不知道你的空间都支持什么,只要是支持asp,php或者jsp,都可以。