html兼容问题总结

<meta http-equiv="refresh" content="3;URL=javascript: window.open('http://www.baidu.com', 'parent');">
测试结果
该语句在chrome, opera 运行OK,在firefox, ie6, ie9不能正常运行


<input name="" type="button" value="" onclick="location.href='index.html'"/>
</a>

这里的input要是没有onclick的话 , 在IE里面是没有效果的 , 点击的时候不会发生跳转

input的background-image不显示的解决办法

IE系列浏览器的css兼容问题非常棘手,好比设置input按钮的属性background-image,chrome和firefox只需两行代码便可搞掂。javascript

代码为:css

background-image: url(images/test.jpg);
background-repeat: no-repeat;html

可是,上面那两行代码在IE六、IE8看来,是无效的,也便是background-image属性失效不显示。java

后来找到了解决办法,增长两行代码便可,以下:chrome

background-image: url(images/test.jpg);
background-repeat: no-repeat;
background-color: transparent;
border:none;浏览器

关键是background-color: transparent,将背景色设置为透明,好让背景图显示出来。


下面是加入收藏的代码=====》
只有IE能用 , FireFOx , chrome 都不行
<a
href='javascript:window.external.AddFavorite(location.href,document.title)'">加入收藏</a>


这个兼容火狐和 IE , 可是在chrome下面也行不通
<script type='text/javascript'>
function addfavor(url,title) {
    if(confirm("网站名称:"+title+"\n网址:"+url+"\n肯定添加收藏?")){
        var ua = navigator.userAgent.toLowerCase();
        if(ua.indexOf("msie 8")>-1){
            external.AddToFavoritesBar(url,title,'');//IE8
        }else{
            try {
                window.external.addFavorite(url, title);
            } catch(e) {
                try {
                    window.sidebar.addPanel(title, url, "");//firefox
                } catch(e) {
                    alert("加入收藏失败,请使用Ctrl+D进行添加");
                }
            }
        }
    }
    return false;
}
</script>



添加网页上的QQ按钮, 实现客服的功能
                                        <a href="tencent://message/?uin=2345678&Site=testXXX&Menu=yes"><img src="http://wpa.qq.com/pa?p=1:234567:4" alt="LGF"></a>