ie8和谷歌 火狐相容方法

2021-08-20 13:45:29 字數 815 閱讀 4683

1.元素繫結

bobj.attachevent("onclick",hi);      //ie8中支援

addeventlistener("click",hi); //ie8不支援

2.標籤文字設定

textcontent                        // ie8不支援

innertext // 都支援

3.元素樣式獲取

window.getcomputedstyle(box,null).left //谷歌、火狐

box.currenstyle.left //ie8

4.阻止事件冒泡

window.event.cancelbubble=true;    //谷歌,ie8支援

e.stoppropagation(); // 谷歌,火狐支援

5.節點

element.firstchild---->谷歌,火狐獲取第乙個節點

element.firsrchild---->ie8 獲取第乙個元素

element.firstelementchild--->谷歌,火狐第乙個元素,ie8不支援
6.事件處理函式

function(e){}    //谷歌.火狐

function(window.event){} //ie8

IE8 新增class 相容 方法

var div document.getelementbyid followforum div.classname btn focus has sign 相容所有瀏覽器 一 el.setattribute class abc 複製 如下 test div ie6 7 div背景色不是紅色 ie8 9...

ie8相容rgba的方法

現在做個網頁還得考慮ie8,只想說 尼瑪!但是沒辦法,屈於淫威也得弄。首先說下rgba的含義吧,rgba,r代表red,g代表green,b代表blue,a代表透明度。filter progid dximagetransform.microsoft.gradient startcolorstr b2...

處理ie8相容

1.ie8換成edge模式渲染 x ua compatible content ie edge 2.x ua compatible是針對ie8新加的乙個設定,對於ie8之外的瀏覽器是不識別的,這個區別與content ie 7 在無論頁面是否包含指令,都像是使用了 windows internet ...