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>
<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>
相关文章推荐
- JS事件在IE与FF中的区别
- IE和FF之js 区别
- js之event对象获取在FF和IE下的区别
- IE和FF之js 区别(2)
- JS事件在IE与FF中的区别
- JS在操作IE与FF的一些区别
- 引用 js在IE和FF的区别
- IE和FF之js 区别
- 引用 js在IE与FF之间的区别详细解析
- JS事件在IE与FF中的区别详细解析
- JS事件在IE与FF中的区别详细解析
- js的setTimeout在IE和FF的区别.
- IE和FF之js 区别
- IE和FF区别关于css和js
- 引用 js在IE与FF之间的区别详细解析
- JS实现设置ff与ie元素绝对位置的方法
- JS在IE与firefox下用法之区别
- 我看IE与FF------Js读取xml文件
- js复制数据IE,FF..浏览器兼容
- JS拖动层(支持ie,ff,opera,safari)