谈谈随滚动条始终不动的div 不管滚动条怎么拉,div始终相对屏幕位置不变,就像网易空间右下角的那种,一点都不卡,请高手指导指导。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <div style="background: none repeat scroll 0% 0% Red; width: 100px; height: 100px; bottom: 10px; right: 10px; position: fixed;"></div> 关键的样式:xxx{bottom:10px;right:10px;position:fixed;} ie6还要看这个http://bbs.blueidea.com/thread-2930592-1-1.html LZ看看这个例子<html> <head> <script language = "javascript"> var checks = 0; var GB =0; function openwindow() { checks = document.getElementById("player").style.pixelTop; GB = document.getElementById("myplay").style.pixelTop; } function move() { document.getElementById("player").style.pixelTop = checks + document.body.scrollTop; document.getElementById("myplay").style.pixelTop = GB + document.body.scrollTop; } function guna() { document.getElementById("myplay").style.display = "none"; document.getElementById("player").style.display = "none"; } window.onscroll = move; </script> </head> <body onload = "openwindow()"> <div id = "play" style = "position:absolute;height:2000px;width:990px;background-color:orange;z-index:1"></div> <div id = "player" style = "position:absolute;height:100px;width:100px;left:900px;top:100px;background-color:blue;z-index:2"></div> <div id = "myplay" style = "position:absolute;heigth:20px;width:40px;left:970px;top:80px;z-index:3" onclick = "guna()"><font size = 3 color = red><a href = "#">关闭</a></font></div> </body></html> postion:fixed 只可惜IE6不支持 用 固定定位 IE: 用那个 经典的 模拟固定定位 的CSS (纯CSS就可实现) 这些属性和值有什么区别? 怎么让 i 的值全程同步 为什么我的JS对DIV2不起效果? 正则表达式问题? 怎么样用javascript取XML标签的值? 如何获得框架中页面的标题?? 复选框传值问题! 禁止页面刷新,包括鼠标\键盘\F5,如何实现? 关于打印的问题? 都是很简单的小问题,可是我不会? 用JS写了一个遍历文件夹获取每个文件信息的网页,但是点打开浏览对话框,选择路径时总提示“没有权限”,求高人指点 在javascript创建xml文件时,如何添加<?xml version="1.0" encoding="utf-8" ?>
http://bbs.blueidea.com/thread-2930592-1-1.html
<head>
<script language = "javascript">
var checks = 0;
var GB =0;
function openwindow()
{
checks = document.getElementById("player").style.pixelTop;
GB = document.getElementById("myplay").style.pixelTop;
}
function move()
{
document.getElementById("player").style.pixelTop = checks + document.body.scrollTop;
document.getElementById("myplay").style.pixelTop = GB + document.body.scrollTop;
}
function guna()
{
document.getElementById("myplay").style.display = "none";
document.getElementById("player").style.display = "none";
}
window.onscroll = move;
</script>
</head>
<body onload = "openwindow()">
<div id = "play" style = "position:absolute;height:2000px;width:990px;background-color:orange;z-index:1"></div>
<div id = "player" style = "position:absolute;height:100px;width:100px;left:900px;top:100px;background-color:blue;z-index:2"></div>
<div id = "myplay" style = "position:absolute;heigth:20px;width:40px;left:970px;top:80px;z-index:3" onclick = "guna()"><font size = 3 color = red><a href = "#">关闭</a></font></div>
</body>
</html>