CSS/offset jquery

来源:互联网 发布:淘宝出库单怎么打印 编辑:程序博客网 时间:2024/05/21 20:17

<!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=gb2312" />
<title>CSS/offset</title>
<script src="js/jquery.js"></script>
<script>
$(document).ready(function(){
   var p=$("p:last");
   var offset = p.offset();
   p.html("left:"+offset.left+",top"+offset.top);
})
</script>
<style>
p { margin-left:10px; }
</style>
</head>

<body>
<p>Hello</p><br /><p>2nd Paragraph</p>
</body>
</html>

 

原创粉丝点击