仿新浪微博返回顶部怎样用纯JS做? 知道有一个onscroll的方法,不过无从下手,求高手教导,先谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!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" /></head><body><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script> <script type="text/javascript"> //怎么获取网页的高度 让页面一出来就滚动条在最底端 function myScroll() { //前边是获取chrome等一般浏览器 如果获取不到就是ie了 就用ie的办法获取 var x=document.body.scrollTop||document.documentElement.scrollTop; var timer=setInterval(function(){ x=x-100; if(x<100) { x=0; window.scrollTo(x,x); clearInterval(timer); } window.scrollTo(x,x); },"200"); //200毫秒 控制滚动条的速度} </script> <title></title> </head> <body id="bd"> <div> <div style="height:1000px;">初始化</div> <div style="height:1000px"> <div style="position:fixed;right:10px;bottom:50px;width:20px;height:70px;background-color:red;cursor:hand;" onclick="myScroll()">返回顶端</div> </div> </body> </html> 本地html文件间如何传递数据 Extjs 文本框如何获取后台数据? 当一个a链接的HREF里有值了,再次用attr能否改变其值。 急急急,非常急 怎样在外部设置JS中属性的值 求《javascript高级程序设计》的电子版下载地址 各位大哥帮忙解决下 表单上只有一个文本框,按回车后就刷新页面,如何搞定? 如何实现在程序运行时加减代码? 模拟表单提交获取网页上的数据 哎,时间不够了,求一个类似虾米首页的东东 jsp页面表格求和用js怎么实现?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head><body><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript">
//怎么获取网页的高度 让页面一出来就滚动条在最底端
function myScroll() {
//前边是获取chrome等一般浏览器 如果获取不到就是ie了 就用ie的办法获取
var x=document.body.scrollTop||document.documentElement.scrollTop;
var timer=setInterval(function(){
x=x-100;
if(x<100) {
x=0;
window.scrollTo(x,x);
clearInterval(timer);
}
window.scrollTo(x,x);
},"200"); //200毫秒 控制滚动条的速度
}
</script>
<title></title>
</head>
<body id="bd">
<div>
<div style="height:1000px;">初始化</div>
<div style="height:1000px">
<div style="position:fixed;right:10px;bottom:50px;width:20px;height:70px;background-color:red;cursor:hand;"
onclick="myScroll()">返回顶端</div>
</div>
</body>
</html>