獲取控件用document.getElementById,不用document.all(FF等瀏覽器不支持)2>
      1. javascript IE與FireFox 一些兼容寫法

        系統(tǒng) 3576 0

        1>獲取控件用document.getElementById,不用document.all(FF等瀏覽器不支持)
        2><button> 會(huì)被firefox解釋為提交form或者刷新頁(yè)面,需要寫標(biāo)準(zhǔn)<button type="button">
        3>使用childNode()代替之前的children?
        4> 手型鼠標(biāo)指針請(qǐng)用cursor:pointer,不用 cursor:hand
        5>獲取自己定義的屬性 用? document.getElementByID("TD1").getAttribute("isOBJ")? 代替document.getElementByID("TD1").isOBJ
        6>事件追加方法attachEvent(IE)/detachEvent;addEventListener( Mozilla, Netscape, Firefox)/removeEventListener
        ? 又或者直接用obj.onmouseover=func;
        7>Firefox中不存在 Event時(shí)間,必須通過object本身去取
        ?? 在Firefox獲取當(dāng)前物件的坐標(biāo)方法:
        ? document.onmousemove = Inti_move;
        ? function? Inti_move(ert)
        {
        ? x=ert.pageX;
        }

        Internet Explorer Name Mozilla Name Description 表4 Mozilla與IE之間的事件屬性差異
        altKey altKey Boolean property that returns whether the alt key was pressed during the event.
        cancelBubble stopPropagation() Used to stop the event from bubbling farther up the tree.
        clientX clientX The X coordinate of the event, in relation to the element viewport.
        clientY clientY The Y coordinate of the event, in relation to the element viewport.
        ctrlKey ctrlKey Boolean property that returns whether the Ctrl key was pressed during the event.
        fromElement relatedTarget For mouse events, this is the element from which the mouse moved away.
        keyCode keyCode For keyboard events, this is a number representing the key that was pressed. It is 0 for mouse events.
        returnValue preventDefault() Used to prevent the event's default action from occurring.
        screenX screenX The X coordinate of the event, in relation to the screen.
        screenY screenY The Y coordinate of the event, in relation to the screen.
        shiftKey shiftKey Boolean property that returns whether the Shift key was pressed during the event.
        srcElement target The element to which the event was originally dispatched.
        toElement currentTarget For mouse events, this is the element to which the mouse moved.
        type type Returns the name of the event.


        8>event.keyCode的問題解決
        在FF中不存在window.event.keyCode屬性。可以用以下方法解決

        function ?keepKeyNum(evt)
        {
        ?
        var ??k = window.event ? evt.keyCode:evt.which;
        ?????
        if ?((k <= 57 )? && ?(k >= 48 ))
        { return ? true ;}
        ?????
        else ?
        { return ? false ;}

        ? < input? type ="text" ?onKeyPress ="?return?keepKeyNum(event);" ? >

        javascript IE與FireFox 一些兼容寫法


        更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

        微信掃碼或搜索:z360901061

        微信掃一掃加我為好友

        QQ號(hào)聯(lián)系: 360901061

        您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

        【本文對(duì)您有幫助就好】

        您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!!!

        發(fā)表我的評(píng)論
        最新評(píng)論 總共0條評(píng)論
        主站蜘蛛池模板: 自拍亚洲国产 | 永久黄网站色视频免费观看99 | 奇米影| 中文字幕久热 | 亚洲网站在线看 | a网在线| 老司机精品在线观看 | 国产小福利 | 日本欧美一区二区三区在线 | 色偷偷在线刺激免费视频 | 五月天色中色 | 麻豆视频一区 | 欧美最大成人毛片视频网站 | 99国产在线观看 | 66精品综合久久久久久久 | 久久的精品99精品66 | 国产福利视频一区美女 | 特黄特黄一级高清免费大片 | 欧美看片 | 青青操夜夜操 | 国内精品久久久久久中文字幕 | 91亚洲精品视频 | 国产性做久久久久久 | 图片专区亚洲欧美另类 | 国内视频一区 | 91精品刘玥在线播放 | 伊人精品视频在线 | 亚洲女人天堂a在线播放 | 亚洲高清成人欧美动作片 | 欧美一级成人一区二区三区 | 国产精品毛片天天看片 | 成人免费在线视频 | 另类重口性色老妇 | 一区二区三区四区在线观看视频 | 九九精品在线 | 国产黄色自拍 | 有色视频在线观看免费高清 | 欧美日韩福利视频一区二区三区 | 精品久久久久久中文字幕欧美 | 天天操狠狠操 | 狠狠插网站 |