怎么判断 是否显示出 返回顶点图标 js 判断滚动条是否出现 或者判断屏幕的位置 然后控制这个DIV 是否显示 隐藏. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www.cnblogs.com/jingangel/archive/2012/03/08/2385939.html <!DOCTYPE html><html><head><meta charset="utf-8" /><title>test</title><style>body{margin:0; padding:0}#to_top{width:30px; height:40px; padding:20px; font:14px/20px arial; text-align:center; background:#06c; position:absolute; cursor:pointer; color:#fff}</style><script>window.onload = function(){ var oTop = document.getElementById("to_top"); var screenw = document.documentElement.clientWidth || document.body.clientWidth; var screenh = document.documentElement.clientHeight || document.body.clientHeight; oTop.style.left = screenw - oTop.offsetWidth +"px"; oTop.style.top = screenh - oTop.offsetHeight + "px"; oTop.onclick = function(){ document.documentElement.scrollTop = document.body.scrollTop =0; }} window.onscroll = function(){ var oTop = document.getElementById("to_top"); var screenw = document.documentElement.clientWidth || document.body.clientWidth; var screenh = document.documentElement.clientHeight || document.body.clientHeight; var scrolltop = document.documentElement.scrollTop || document.body.scrollTop; oTop.style.top = screenh - oTop.offsetHeight + scrolltop +"px"; if(scrolltop>300){ // 滚动条超过某位置才显示返回顶部按钮 oTop.style.visibility = 'visible'; }else{ oTop.style.visibility = 'hidden'; }}window.onresize = function(){ var oTop = document.getElementById("to_top"); var screenw = document.documentElement.clientWidth || document.body.clientWidth; var screenh = document.documentElement.clientHeight || document.body.clientHeight; oTop.style.left = screenw - oTop.offsetWidth +"px"; oTop.style.top = screenh - oTop.offsetHeight + "px";}</script></head><body style="height:2000px;"><h1>返回顶部</h1><div id="to_top" style="visibility:hidden">返回顶部</div></body></html> 中文系统下载日文文件乱码问题 从php页面中获取ID传递到表单里..能解决么? 这是为什么? 为什么结果是这样,感谢 smarty能不能不同参数不同缓存 php5中居然不能用exif_read_data函数???? PHP发送EMAIL求一个完整的成功的例子!急急急!若分不够请讲! 2,5,6,8随机选出一个,应该怎么写,急,谢谢 高手在哪里呀,高手在哪里 【4个数组同时写到数据库怎么写?】 为什么要判断isset后还要判断empty,直接判断empty不是代码更少吗? 1.Ci 框架中表单提交 控制器进行处理的时候发现URL的路径不对
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>test</title>
<style>
body{margin:0; padding:0}
#to_top{width:30px; height:40px; padding:20px; font:14px/20px arial; text-align:center; background:#06c; position:absolute; cursor:pointer; color:#fff}
</style>
<script>
window.onload = function(){
var oTop = document.getElementById("to_top");
var screenw = document.documentElement.clientWidth || document.body.clientWidth;
var screenh = document.documentElement.clientHeight || document.body.clientHeight;
oTop.style.left = screenw - oTop.offsetWidth +"px";
oTop.style.top = screenh - oTop.offsetHeight + "px";
oTop.onclick = function(){
document.documentElement.scrollTop = document.body.scrollTop =0;
}
} window.onscroll = function(){
var oTop = document.getElementById("to_top");
var screenw = document.documentElement.clientWidth || document.body.clientWidth;
var screenh = document.documentElement.clientHeight || document.body.clientHeight;
var scrolltop = document.documentElement.scrollTop || document.body.scrollTop;
oTop.style.top = screenh - oTop.offsetHeight + scrolltop +"px";
if(scrolltop>300){ // 滚动条超过某位置才显示返回顶部按钮
oTop.style.visibility = 'visible';
}else{
oTop.style.visibility = 'hidden';
}
}window.onresize = function(){
var oTop = document.getElementById("to_top");
var screenw = document.documentElement.clientWidth || document.body.clientWidth;
var screenh = document.documentElement.clientHeight || document.body.clientHeight;
oTop.style.left = screenw - oTop.offsetWidth +"px";
oTop.style.top = screenh - oTop.offsetHeight + "px";
}</script>
</head><body style="height:2000px;"><h1>返回顶部</h1>
<div id="to_top" style="visibility:hidden">返回顶部</div>
</body>
</html>