//css float
document.getElementById("header").style.styleFloat = "left"; //ie
document.getElementById("header").style.cssFloat = "left"; //Firefox//获取IE下鼠标的位置
var myCursorPosition = [0, 0];
myCursorPosition[0] = event.clientX;
myCursorPosition[1] = event.clientY;
//获取FF下鼠标的位置
var myCursorPosition = [0, 0];
myCursorPosition[0] = event.pageX;
myCursorPosition[1] = event.pageY;
/*********************************************************************///获取可见区域、窗口的大小IEvar myBrowserSize = [0, 0]; myBrowserSize[0] = document.documentElement.clientWidth; myBrowserSize[1] = document.documentElement.clientHeight; //FFvar myBrowserSize = [0, 0]; myBrowserSize[0]
= window.innerWidth; myBrowserSize[1] = window.innerHeight; /*********************************************************************///下面这个应该是CSS的在IE中这样写: #myElement { filter: alpha(opacity=50); } var myObject = document.getElementById("myElement"); myObject.style.filter = "alpha(opacity=80)"; 在Firefox中这样写: #myElement
{ opacity: 0.5; } var myObject = document.getElementById("myElement"); myObject.style.opacity = "0.5";
本文介绍了在不同浏览器(如IE和Firefox)中实现元素浮动、鼠标位置获取、窗口尺寸测量及透明度设置的方法。通过使用特定语法确保了网页在多种浏览器下的表现一致性。
172

被折叠的 条评论
为什么被折叠?



