如何让div一直保持在屏幕的最下面? 如题有jquery的方法,将一个id=footer的div,始终置于屏幕的最下面吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 有点类似phpwind论坛,登录后,会开启一个div,始终显示在屏幕最下面,无论屏幕如何滚动,它的位置不变 看到msdn里面有个帖子,但是按照这个方法没有效果。。<!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 content="text/html; charset=utf-8" http-equiv="Content-Type" /><title>abc</title><script type="text/javascript" src="jquery-1.4.2.js"></script><script type="text/javascript"> $(document).ready(ResetPosition); $(window).resize(ResetPosition); function ResetPosition() { var div1 = $('#div1'); div1.css("top", $(window).height() - div1.height()); }</script></head><body><div style="height: 3000px; border-style: solid; border-width: 1px"></div><div id="div1" style="position:fixed; height:20px">abc</div></body></html>-------------------------------------------------------------------------------- 发个非jquery的。<!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>Bottom Div</title><style type="text/css">html,body{width:100%;height:100%;margin:0px;padding:0px;}#bottom{width:300px;height:250px;border:1px #FF9900 solid;background-color:#FFCCCC;position:absolute;top:0px;left:0px;visibility:hidden;}</style><script type="text/javascript">window.onload = position;window.onresize = position;function position(){ var bottomDiv = document.getElementById("bottom"); var ch,cw,bottomWidth,bottomHeight; ch = document.body.clientHeight; cw = document.body.clientWidth; bottomWidth = bottomDiv.offsetWidth; bottomHeight = bottomDiv.offsetHeight; with(bottomDiv){ style.top=(ch - bottomHeight)+"px"; style.left=(cw - bottomWidth)+"px"; style.visibility = "visible"; }};</script></head><body><div id="bottom"></div></body></html> position:fixed;/*IE6不支持,其他浏览器通过。*/ 借用下:<!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>Bottom Div</title><style type="text/css">html,body{width:100%;height:100%;margin:0px;padding:0px;}#bottom{width:300px;height:250px;border:1px #FF9900 solid;background-color:#FFCCCC;position:absolute;top:0px;left:0px;visibility:hidden;}</style><script type="text/javascript">window.onload = position;window.onresize = position;function position(){ var bottomDiv = document.getElementById("bottom"); var ch,cw,bottomWidth,bottomHeight; ch = document.body.clientHeight; cw = document.body.clientWidth; bottomWidth = bottomDiv.offsetWidth; bottomHeight = bottomDiv.offsetHeight; with(bottomDiv){ style.top=(ch - bottomHeight)+"px"; style.left=(cw - bottomWidth)+"px"; style.visibility = "visible"; }};</script></head><body><div id="bottom"></div></body></html> 求高手指点~不胜感谢! $('#tabs').tabs();这句话不明白 js遍历TABLE内元素的问题 [下载]google的自动完成代码示例 javascript获取当月的天数 根据标题生成关键字的js代码_求助 一个事件的继承问题(分不够可以再加) 如何用js获取用户在其他网站输入过的信息? 求高手帮忙改正这段代码,让他生效。 鼠标在图片上选择四边框javascript怎么取出两点在图片上的标值 js 图片切换刷屏 如何修改 怎样下载\安装\使用JSlint编写js代码?
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>abc</title>
<script type="text/javascript" src="jquery-1.4.2.js"></script>
<script type="text/javascript">
$(document).ready(ResetPosition);
$(window).resize(ResetPosition);
function ResetPosition()
{
var div1 = $('#div1');
div1.css("top", $(window).height() - div1.height());
}
</script>
</head><body><div style="height: 3000px; border-style: solid; border-width: 1px">
</div>
<div id="div1" style="position:fixed; height:20px">abc
</div>
</body></html>
--------------------------------------------------------------------------------
<!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>Bottom Div</title>
<style type="text/css">
html,body{width:100%;height:100%;margin:0px;padding:0px;}
#bottom{width:300px;height:250px;border:1px #FF9900 solid;background-color:#FFCCCC;position:absolute;top:0px;left:0px;visibility:hidden;}
</style>
<script type="text/javascript">
window.onload = position;
window.onresize = position;
function position(){
var bottomDiv = document.getElementById("bottom");
var ch,cw,bottomWidth,bottomHeight;
ch = document.body.clientHeight;
cw = document.body.clientWidth;
bottomWidth = bottomDiv.offsetWidth;
bottomHeight = bottomDiv.offsetHeight;
with(bottomDiv){
style.top=(ch - bottomHeight)+"px";
style.left=(cw - bottomWidth)+"px";
style.visibility = "visible";
}
};
</script>
</head>
<body>
<div id="bottom"></div>
</body>
</html>
position:fixed;
/*IE6不支持,其他浏览器通过。*/
<!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>Bottom Div</title>
<style type="text/css">
html,body{width:100%;height:100%;margin:0px;padding:0px;}
#bottom{width:300px;height:250px;border:1px #FF9900 solid;background-color:#FFCCCC;position:absolute;top:0px;left:0px;visibility:hidden;}
</style>
<script type="text/javascript">
window.onload = position;
window.onresize = position;
function position(){
var bottomDiv = document.getElementById("bottom");
var ch,cw,bottomWidth,bottomHeight;
ch = document.body.clientHeight;
cw = document.body.clientWidth;
bottomWidth = bottomDiv.offsetWidth;
bottomHeight = bottomDiv.offsetHeight;
with(bottomDiv){
style.top=(ch - bottomHeight)+"px";
style.left=(cw - bottomWidth)+"px";
style.visibility = "visible";
}
};
</script>
</head>
<body>
<div id="bottom"></div>
</body>
</html>