就在已有的页面用js动态插入一段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> <title>testing</title><style type="text/css">.shape{width:200px; height: 140px; position:fixed!important; position:absolute; right:5px; bottom:5px!important; bottom:auto; top: expression(eval(document.compatMode && document.compatMode=='CSS1Compat') ? documentElement.scrollTop+(documentElement.clientHeight - this.clientHeight):document.body.scrollTop+(document.body.clientHeight - this.clientHeight));}.shape .con{width:200px; height:100px; background: url(http://static.l99.com/skin/default/images/versus/pk_vote_record.gif) no-repeat;}.shape .btn{width:200px; height:40px; background: url(http://static.l99.com/skin/default/images/versus/pk_vote_record.gif) no-repeat 0 -100px;}.height{height:1300px;}</style></head><body><div class="shape"><div class="con"></div><div class="btn"></div></div><div class="height"></div></body></html>
<div style="left:0; bottom:0; POSITION:absolute; width:100px; height:100px; z-index:100;">我要固定浮动在底部</div>
到底要底部哪个位置,自己改下left:***
#foot{position:fixed;_position:absolute;bottom:0px;_bottom:0px;_margin-top:expression(this.style.pixelHeight+document.documentElement.scrollTop)}
试下。
我的意思是随便找个页面,粘贴上这段代码,这个div就可以固定浮动在页面最低端,
拖动滚动条浏览始终在最低端
<!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> <title>testing</title><style type="text/css">#foot{position:fixed;_position:absolute;bottom:0px;_bottom:0px;_margin-top:expression(this.style.pixelHeight+document.documentElement.scrollTop)}</style></head><body style="height:5000px;"><div id="foot">我不在下面?</div></body></html>
document.getElementById("shows").style.top=(document.documentElement.scrollTop || document.body.scrollTop)+ieheight-5-showsHeight+"px";
HTML code
我的意思是随便找个页面,粘贴上这段代码,这个div就可以固定浮动在页面最低端,
拖动滚动条浏览始终在最低端
这个不能用吗?
<div style="left:0; bottom:0; POSITION:absolute; width:100px; height:100px; z-index:100;">我要固定浮动在底部</div>
引用 4 楼 coolzdp 的回复:
我的意思是随便找个页面,粘贴上这段代码,这个div就可以固定浮动在页面最低端,
拖动滚动条浏览始终在最低端
这个不能用吗?
HTML code
Not bad, very good and powerful
I would like to ask, in this case, can it be used? Also horizontally centered? ? ?
Can horizontal centering be achieved at the same time?
[Quote=Quote 6th floor’s reply:]
document.getElementById("shows").style.top=(document.documentElement.scrollTop || document .body.scrollTop) ieheight-5-showsHeight "px";
This works~~