chenfahui'Blog

陈发辉的个人主页 chenfahui.cn

« SWFUpload 多文件图片上传判断浏览器否为IE6 »

取得div的top值和left值

要取得top值和left值,先要把这个div的定位设为 relative 或者 absolute

比如:<div id="txtArea" style="width:470;height:25;position:relative;left:0;top:0;"></div> 

 

top值: document.getElementById('txtArea').offsetTop+document.body.scrollTop
left值:document.getElementById('txtArea').offsetLeft;

发表评论

网站分类

文章归档

Tags

Powered By Z-Blog 1.8 Walle Build 100427
Copyright 2009-2012 chenfahui.cn. Some Rights Reserved.www.chenfahui.cn网站PR查询