右下角跟随滚动条移动的图片 我想实现 当拉动滚动条的时候图片始终在右下角显示。。是相对屏幕静止的。并点击图片的时候返回页面的顶部。求完整代码~~~ 谢谢~~ 解决方案 » 免费领取超大流量手机卡,每月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" /><title>无标题文档</title><style>*{ margin:0; padding:0;}.mock{ height:900px; width:900px; margin:0 auto; background:#333; color:red;}.fixedImg{ width:160px; height:240px; position:fixed; bottom:0; right:0; z-index:10px;}</style></head><body><div class="mock">啊啊啊啊啊啊啊</div><img src="http://farm7.static.flickr.com/6185/6075453511_63636c1b05_m.jpg" class="fixedImg" id="fixedImg" /><script type="text/javascript"> function $(el){return document.getElementById(el)}; var o = $("fixedImg"); o.onclick = function(){ document.body.scrollTop = 0; };</script></body></html>仅支持chrome,要用的话再写兼容的版本吧。1.IE6不支持fixed,用JS模拟吧。2.FF和IE获取scrollTop应该是document.documentElement.scrollTop,记不太清了 其实position:fixed;就挺好的 了。。 关于js动态切换图片问题 javascript函数能传引用吗 如何修改样式 line and border 求关于怎样学好javascript的方法 我想把经常用的函数放到一个JS文件里,需要某个函数的时候调用那个文件中的那个函数可以吗? 为什么document.form1.submit();在jsp页面老提示属性或对象不存在啊?? 高分的求助一个简单的问题 拖动FrameSet的分割条,调整frame大小时触发的事件是什么? 怎么将用confirm弹出的窗口默认为取消 各位大侠谁能解决这个问题? 求讲解,如何实现在弹出的层里面切换页面?ajax吗? 怎样把这jquery的语句翻译成js的?
<!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" />
<title>无标题文档</title>
<style>
*{
margin:0;
padding:0;
}
.mock{
height:900px;
width:900px;
margin:0 auto;
background:#333;
color:red;
}
.fixedImg{
width:160px;
height:240px;
position:fixed;
bottom:0;
right:0;
z-index:10px;
}
</style>
</head>
<body>
<div class="mock">
啊啊啊啊啊啊啊
</div>
<img src="http://farm7.static.flickr.com/6185/6075453511_63636c1b05_m.jpg" class="fixedImg" id="fixedImg" />
<script type="text/javascript">
function $(el){return document.getElementById(el)};
var o = $("fixedImg");
o.onclick = function(){
document.body.scrollTop = 0;
};
</script>
</body>
</html>
仅支持chrome,要用的话再写兼容的版本吧。
1.IE6不支持fixed,用JS模拟吧。
2.FF和IE获取scrollTop应该是document.documentElement.scrollTop,记不太清了