JavaScript Reference/Javascript Properties/offsetLeft
"offsetLeft" Example
<html>
<body>
<div id="myDiv"
style="position:absolute;
left:150;
top:100;
width:400;
height:200;
background-color:blue;">
</div>
<button onclick="alert(myDiv.offsetLeft);">offsetLeft</button>
</body>
</html>
"offsetLeft" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |<a> <acronym> |
| |<address> <applet> |
| |<area> <b> |
| |<base> <basefont> |
| |<bdo> <big> |
| |<blockquote> <body> |
| |<br> <button> |
| |<caption> <center> |
| |<cite> <code> |
| |<col> <colgroup> |
| |<custom> <dd> |
| |<del> <dfn> |
| |<dir> <div> |
| |<dl> <dt> |
| |<em> <embed> |
| |<fieldset> <font> |
| |<form> <frame> |
| |<frameset> <head> |
| |<hn> <hr> |
| |<html> <i> |
| |<iframe> <img> |
| |<input type="button"> <input type="checkbox"> |
| |<input type="file"> <input type="image"> |
| |<input type="password"> <input type="radio"> |
| |<input type="reset"> <input type="submit"> |
| |<input type="text"> <ins> |
| |<isindex> <kbd> |
| |<label> <legend> |
| |<li> <link> |
| |<listing> <map> |
| |<marquee> <menu> |
| |<meta> <nobr> |
| |<noframes> <noscript> |
| |<object> <ol> |
| |<optgroup> <option> |
| |<p> <param> |
| |<plaintext> <pre> |
| |<q> <rt> |
| |<ruby> <s> |
| |<samp> <script> |
| |<select> <small> |
| |<span> <strike> |
| |<strong> <style> |
| |<sub> <sup> |
| |<table> <tbody> |
| |<td> <textarea> |
| |textRange <tfoot> |
| |<th> <thead> |
| |<title> <tr> |
| |<tt> <u> |
| |<ul> <var> |
| |<xmp> |
+----------------+--------------------------------------------------------------+
"offsetLeft" Syntax and Note
Note:
Read-only properties.
Return the horizontal coordinates of the upper-left corner of
block-level or inline element.
Syntax:
document.getElementById("elementID").offsetLeft
document.all.elementID.offsetLeft // IE only
document.getElementById("elementID").offsetTop
document.all.elementID.offsetTop // IE only