<html>
<script>
function test()
{
for(i=0;i<window.frames.length;i++)
{
window.frames[i].location="about:blank";
}
window.frames[0].location="a.htm";
}
</script>
<body onload="test()">
<iframe src="a.htm" width="100" heigth="100">
<iframe src="b.htm" width="100" heigth="100">
</body>
</html>你看这样能不能满足你的要求
<script>
function test()
{
for(i=0;i<window.frames.length;i++)
{
window.frames[i].location="about:blank";
}
window.frames[0].location="a.htm";
}
</script>
<body onload="test()">
<iframe src="a.htm" width="100" heigth="100">
<iframe src="b.htm" width="100" heigth="100">
</body>
</html>你看这样能不能满足你的要求
不过要是你学过SEO就不会放那么多广告的
GOOGLE的广告一个页面不超过2个
做过SEO的人都知道
优化网站的第一部就是靠GOOGLE
你放那么多
那么网页的单价点击接很少了的
可不可以在iframe里面调用的网页里面加入互斥啊?
如果我修改其中一个iframe里面的内容为空,哪全部为空了,也就没广告了,要是不清除,哪就有4个广告,好晕,,把我想他能不能一个互斥的,第一个iframe运行以后,哪后面的就去判断该子页面是否己在该页面执行过,如果执行过,哪就不执行了,,
(我只能控制iframe所调用的页面哦!)
<html>
<script>
function test()
{
for(i=0;i<parent.frames.length;i++)
{
parent.frames[i].location="about:blank";
}
parent.frames[0].location="a.htm";
}
</script>
<body onload="test()">
<iframe src="a.htm" width="100" heigth="100">
<iframe src="b.htm" width="100" heigth="100">
</body>
</html>
把代码写在任一个框架页内,把window改为parent就行了。
还是不大明白哦,
<body onload="test()">
<iframe src="a.htm" width="100" heigth="100">
<iframe src="b.htm" width="100" heigth="100">这里也是调用a.htm
</body>
如何window哈,要他们互斥,是不是有一个他们共享的标志哈?
第一个iframe运行后,就改变该标志,后面检测该标志的值,判断a.htm是否己经运行过
你的iframe结构如何?
<html>
<body>
<iframe src="a.htm" width="100" heigth="100">
<iframe src="a.htm" width="100" heigth="100">
<iframe src="a.htm" width="100" heigth="100">
<iframe src="a.htm" width="100" heigth="100">
</body>
</html>
哪果a.htm里面是google广告,哪在这个页面里面,他们出现四个广告哦,哪相对于GOOGLE的政策,问题就严重了
我希望他在第一个iframe调用成功后,哪后面就不调用了,
我的权限,也只能修改a.htm里面的代码,这里面如何修改,才能让他只运行一次呢?
我曾经有个思路,是在里面初始一个变量flag,先判断他是否等于1,如果是1,哪就停止加载页面,如果变量非1,哪在他一调用iframe后,里面的变量开始赋值flag=1,哪后面的iframe,也会照这个过程去判断,但是我没有想到iframe里面的变量和父窗口里面的变量是不通用了,所以我在找一个他们能共同访问的焦点,然后通过设置这个焦点去判断,当初一时的失误,带来的麻烦,好晕,,
现求各位高手不吝赐教!
还有你的iframe有没有name?还有是否只有广告得iframe,还是还有其他的,这些都会影响倒做法的
function test()
{
for(i=1;i<parent.frames.length;i++)
{
parent.frames[i].location="about:blank";
}
}
</script>那这样就行了
如果他能修改top window 页面的代码,那就加入id或name来识别,
如果不能修改top window 页面的代码,就人工数下是哪几个框架,根据情况作修改就行了,这个只是基本实现。
15楼的朋友,select case在此如何应用啊?
<html>
<body>
<iframe src="a.htm" width="100" heigth="100">
<iframe src="a.htm" width="100" heigth="100">
<iframe src="a.htm" width="100" heigth="100">
<iframe src="a.htm" width="100" heigth="100">
</body>
</html>全部这样的还命名有什么规律???这个就是要靠他说的那个来数多少个来控制
if (parent.frames[i].src="a.htm")
{
parent.frames[i].location="about:blank";
}
2 kongxiangli 的方法:遍历每个iframe在你的a.htm中处理onload事件
window.onload()
{
window.top.变量 = true/false;
或者:
for(...)
{
if(iframe.src == "a.htm")
{
window.location = "about blank";
}
}
}
{
parent.frames[i].location="about:blank";
}
else
{
//广告脚本???
}
if (parent.frames[i].src == "a.htm")
{
// 那么当前的广告地址应该为空了
window.location = "about:blank";
} 不用else了,因为已经跳转了。
不过这有问题:因为你自己这个页面也属于iframe并且它的src是a.htm
所以你还要加上判断不是当前页面。