日期:2014-05-17 浏览次数:20611 次
<!DOCTYPE HTML> <html> <head> <meta charset="gb2312" /> <title></title> <style> </style> </head> <body> <div> <div> <a href="" id="test">123</a> </div> </div> <script> function $(el){ return typeof el == 'string' ? document.getElementById(el) : el; } $('test').innerHTML = $('test').offsetLeft </script> </body> </html>