ASP.NET中如何让DIV控件随网页的滚动条而移动 在一个网页里,我做了个DIV控件,我想要实现的效果是如何让这个DIV控件随网页的滚动条而移动,就是我拉下滚动条时,这个DIV控件也一起移下来,就是不管我怎么拉,我的屏幕上始终能看到这个DIV控件 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 css里面有个定位的属性叫position:fixedfixed 位置被设置为 fixed 的元素,可定位于相对于浏览器窗口的指定坐标。此元素的位置可通过 "left"、"top"、"right" 以及"bottom" 属性来规定。不论窗口滚动与否,元素都会留在那个位置。工作于 IE7(strict 模式)。 http://ad.jz123.cn/ad/01/其实你要的效果这里有JS去下载他的JS看吧 <html> <head> <title>wujinjian</title> </head> <script language="javascript"> function move() { var y=200; var y=document.body.scrollTop+y; eval("document.all.imageLayer2.style.posTop=y"); setTimeout("move();",1); } </script> <body onLoad="move()"> <div id=imageLayer2 style="position:absolute;visibility:visible;left:500px;top:200px;width:100px;height:100px;background-color:red;"> </div> 8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br> 8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br> </body></html>将代码复制下来,保存为*.html,双击打开看看是不是你要的那种效果。 这东西你用google能找出一堆来 setInterval(function(){document.getElementById("div1").style.top=document.body.clientHeight+"px";},200); 关于jquery js语法错误 .net三层架构中Factory 省市县数据库 带邮编 区号 客户端按钮如何在服务端里找到 关于引用问题!!!在线等!!急!!! 怎么让线程更新数据 20分求如何实现保存文件时弹出另存为对话框,急!~ 怎样获取datalist中checkbox被选中的个数 晕!和以前的代码一样,却不能完成功能??? 在ASP.NET中使用MSXML的问题,请知道的指点一二 ASP.NET代码生成器
fixed 位置被设置为 fixed 的元素,可定位于相对于浏览器窗口的指定坐标。此元素的位置可通过 "left"、"top"、"right" 以及"bottom" 属性来规定。不论窗口滚动与否,元素都会留在那个位置。工作于 IE7(strict 模式)。
其实你要的效果这里有
JS去下载他的JS看吧
<head>
<title>wujinjian</title>
</head>
<script language="javascript">
function move()
{
var y=200;
var y=document.body.scrollTop+y; eval("document.all.imageLayer2.style.posTop=y");
setTimeout("move();",1);
}
</script>
<body onLoad="move()">
<div id=imageLayer2 style="position:absolute;visibility:visible;left:500px;top:200px;width:100px;height:100px;background-color:red;">
</div>
8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>
8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>8<br>
</body>
</html>将代码复制下来,保存为*.html,双击打开看看是不是你要的那种效果。
document.getElementById("div1").style.top=document.body.clientHeight+"px";
},200);