浮动层代码兼容xhtml 测试可用
<!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=gb2312" />
<title>智思网 http://www.zhisi.net 欢迎您的光临!</title>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#F7F7F7">
<tr>
<td height="2101"></td>
</tr>
</table>
<!--***********代码开始*************-->
<style type="text/css">
div#floatTips{
font-size:14px;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-weight:bold;
position:absolute;
border:solid 1px #777;
padding:3px;
top:200px;
left:500px;
width:250px;
background:#cf9;
color:#f30;
line-height:2;
}
</style>
<div id="floatTips">
智思网 http://www.zhisi.net <br />欢迎您的光临!
</div>
<script type="text/javascript">
//<![CDATA[
var tips; var theTop = 200/*这是默认高度,越大越往下*/; var old = theTop;
function initFloatTips() {
tips = document.getElementById('floatTips');
moveTips();
};
function moveTips() {
var tt=50;
if (window.innerHeight) {
pos = window.pageYOffset
}
else if (document.documentElement && document.documentElement.scrollTop) {
pos = document.documentElement.scrollTop
}
else if (document.body) {
pos = document.body.scrollTop;
}
pos=pos-tips.offsetTop+theTop;
pos=tips.offsetTop+pos/10;
if (pos < theTop) pos = theTop;
if (pos != old) {
tips.style.top = pos+"px";
tt=10;
}
old = pos;
setTimeout(moveTips,tt);
}
initFloatTips();
//!]]>
</script>
<!--**********代码结束***************-->
</body>
</html>
- 暂时没有评论!