您的位置:首页 > Web前端 > JavaScript

JS在ff和ie区别(未完,待续...)

2011-03-16 18:42 253 查看
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>JS在ff和ie区别</title>
<style>
*{margin:0;padding:0;}
.test3{ width:100px; height:100px; background-color:#f00}
</style>

</head>

<body>
<select id="sel" class="test1"></select>
<label for="test2" id="lb"></label>
<div class="test3" id="odiv"></div>
<script>
var foo=document.getElementById('sel');
var foo2=document.getElementById('lb');
var foo3=document.getElementById('odiv');

alert(foo.getAttribute('class')) //w3c
alert(foo.getAttribute('className')) //IE6 7

alert(foo2.getAttribute('for')) //w3c
alert(foo2.getAttribute('htmlFor')) //IE6 7

foo3.style.cssFloat='right' //w3c
foo3.style.styleFloat='right' //IE

foo3.style.opacity='0.5'; //w3c
foo3.style.filter='alpha(opacity=50)' //IE

if(!!document.all){
alert('IE brower')
}else{
alert('not IE brower')
}

</script>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: