处理浏览器兼容你最喜欢用哪种方式
生活随笔
收集整理的這篇文章主要介紹了
处理浏览器兼容你最喜欢用哪种方式
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
<script?type="text/javascript">
通過這個盒子的屬性名來獲取屬性值(條件是兼容所有瀏覽器)//var?oDiv?=?document.getElementById("oDiv");/*function?getCss(curEle,attr)?{var?val?=?null;try?{val?=?window.getComputedStyle(curEle,null)[attr];}catch?(e){val?=?curEle.currentStyle[attr];}return??val;}console.log(getCss(oDiv,"width"));*//*function?getCss(curEle,attr)?{var?val?=?null;if?("getComputedStyle"?in?window){val?=?window.getComputedStyle(curEle,null)[attr];}else?{val?=?curEle.currentStyle[attr];}return??val;}console.log(getCss(oDiv,"width"));*//*function?getCss(curEle,attr){var?val?=?null;if?(window.getComputedStyle){val?=?window.getComputedStyle(curEle,null)[attr];}else?{val?=?curEle.currentStyle[attr];}return?val;}console.log(getCss(oDiv,"width"));*//*function?getCss(curEle,attr){var?val?=?null;if?(/MSIE?(6|7|8)/.test(window.navigator.userAgent)){val?=?curEle.currentStyle[attr];}else?{val?=?window.getComputedStyle(curEle,null)[attr];}return?val;}console.log(getCss(oDiv,"width"));*/
</script>
轉載于:https://blog.51cto.com/11415078/1901350
總結
以上是生活随笔為你收集整理的处理浏览器兼容你最喜欢用哪种方式的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: log4j(六)——log4j.prop
- 下一篇: Hibernate 拦截器的使用--动态