Archive

Posts Tagged ‘IE6’

判断网页是否在iframe中

May 19th, 2010 No comments

网上提供的很多方法都是判断当前窗口与顶部窗口是否相同来实现。代码如下

if(top!=this){
 // 在frame中时处理
}

但这个脚本并没有区分frame和iframe。

  在使用脚本时IE下遇到奇怪的问题:页面只有在iframe有问题frame中是正常的。而且在firefox和chrome中都是正常的。已经不想对IE发表什么意见了,最终自己在MSDN找到了可以判断当前页面是否在iframe中的方法,脚本如下:

if(self.frameElement.tagName=="IFRAME"){
  // 页面在iframe中时处理
}

frameElement属性MSDN页面

Categories: Javascript Tags: ,

IE overflow auto的宽度问题

March 31st, 2010 No comments

在IE中,当窗口的样式为overflow:auto时,出现滚动条的时候,内部元素的宽度不会自适应

解决方法是在样式中把内部元素的宽度用expression定义

div.parent{
	width:300px;
	height:500px;
	overflow:auto;
}
div.sub{
	width:expression(this.parentNode.offsetHeight > this.parentNode.scrollHeight ? '100%' : parseInt(this.parentNode.clientWidth) + 'px');
	height:800px;
}
Categories: CSS Tags: ,

完全禁用Flash右键菜单(IE only)

January 20th, 2010 No comments

在网页上加入以下Javascript代码

<script type="text/javascript">
function handleclick() {
	if (event.button == 2 && "OBJECT" == event.srcElement.tagName.toUpperCase()) doNothing;
}
document.onmousedown = handleclick;
</script>

实现原理:
当右键点击flash的时候让IE报错,代码中的doNothing从未声明。

缺点:
右键点击flash后,状态栏上会出现“网页上有错误” :twisted:

Categories: Flash, Javascript Tags: , ,

Min/Max-Height/Width for IE

January 14th, 2010 No comments

IE6:_height/_width 等价于 min-height/min-width

IE6:-height/-width 等价于 max-height/max-width

Categories: CSS Tags: ,

IE PNG Fix 绝佳方案

January 4th, 2010 No comments

互联网上解决这个IE6的透明PNG的方案也是多不胜数,从使用IE特有的滤镜或是e­xpression,再到javascript+透明GIF替代.但是这些方法都有一个缺点,就是不支持CSS中backgrond-position与background-repeat.

DD_belatedPNG支持backgrond-position与background-repeat.这是其他js插件不具备的.同时DD_belatedPNG还支持a:hover属性,以及<img>.
Read more…

Categories: CSS, Javascript Tags: , , ,

IE Bug(position:relative and overflow)

January 4th, 2010 No comments

以下代码将展示此问题:

<div id="container">
    <div id="a"></div>
    <div id="b"></div>
</div>

相关样式: Read more…

Categories: CSS Tags: ,

让IE6支持png半透明图片(支持背景平铺、定位)

June 19th, 2009 No comments

下载
IE PNG Fix
这里简单说一下使用方法和注意事项:
1. 把 iepngfix.htc 和 blank.gif 复制到网站相应的目录下(目录由自己决定)
2. 然后要在页面的头部信息中调用 iepngfix.htc 文件,像这样:

<style type="text/css">
    img, div{behavior:url(iepngfix.htc);}
</style>

Read more…

Categories: CSS Tags: ,