<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>浮动广告</title>
<style type="text/css">
*{padding:0px;margin:0px;}
.scrollAdver{120px;height:240px;background:red;position:absolute;top:120px;left:6px;}
</style>
<script type="text/javascript">
window.onload=function()
{
var getObj=document.getElementsByTagName("div")[0];
if(document.all)//如果为IE浏览器
{
alert(getObj.currentStyle.top)
}
else if(window.getComputedStyle)//如果为FF或者其他浏览器
{
alert(window.getComputedStyle(getObj,null).getPropertyValue("top"))
}
}
</script>
</head>
<body>
<div class="scrollAdver"></div>
</body>
</html>