<div id="box">
111
</div>
<script>
//JS判断浏览器是否支持元素某个属性
var box = document.getElementById('box');
console.log(typeof box.id);
console.log(typeof box.sss);
//处理innerText浏览器将兼容问题
如果不存在改属性则返回undefined
</script>
<div id="box">
111
</div>
<script>
//JS判断浏览器是否支持元素某个属性
var box = document.getElementById('box');
console.log(typeof box.id);
console.log(typeof box.sss);
//处理innerText浏览器将兼容问题
如果不存在改属性则返回undefined
</script>
本文标题:JS判断浏览器是否支持元素某个属性
本文链接:https://www.haomeiwen.com/subject/ooepuctx.html
网友评论