风易博客

风萧萧兮易水寒, 壮士一去兮不复还。

« 彻底解决config.nt 系统文件不适用于运行 MS-DOS 与 Microsoft Window风易在线推出海外空间,敬请期待! »

让层随心所欲定位!

会说话的博客,点我试试:)
为了避免因客户端浏览器的差异,导致DIV走样,可以用JS控制层以页面上的任何参照物来定位,代码如下:

var b = document.getElementById("Layer1");
var a = document.getElementById("buyman");
var orect = a.getBoundingClientRect();
b.style.position="absolute";
b.style.left = orect.left - 1;
b.style.top = orect.top + document.body.scrollTop + 18;
  • 相关文章:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

日历

最新评论及回复

最近发表

Powered By Z-Blog 1.8 Spirit Build 80722 Code detection by Codefense  theme by BokeZhuti

Copyright © 2005 - 2008 风易博客 1982Y.Net.Cn All Rights Reserved.  由Wind88.Net提供优质主机空间
沪ICP备05006417号