Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-17-2010, 02:54 PM   PM User | #1
alcool9999
New Coder

 
Join Date: Aug 2009
Posts: 84
Thanks: 10
Thanked 0 Times in 0 Posts
alcool9999 is an unknown quantity at this point
CSS Position

Hi, i am simply trying to alert the left position of a css layer.

Javascript:
Code:
var Element = document.getElementById('box');
alert(Element.style.left);
CSS
Code:
#box {position:absolute;
left:150px;
top:150px;
background-color:blue;
height:100;
width:100;}
HTML
Code:
<div id="box">
</div>
The problem is the alert is blank and i can't understand why.

thanks
alcool9999 is offline   Reply With Quote
Old 07-17-2010, 03:06 PM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
The problem is the alert is blank and i can't understand why.
See http://blog.stchur.com/2006/06/21/css-computed-style/
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 07-17-2010, 03:17 PM   PM User | #3
alcool9999
New Coder

 
Join Date: Aug 2009
Posts: 84
Thanks: 10
Thanked 0 Times in 0 Posts
alcool9999 is an unknown quantity at this point
Thanks i understand now.
alcool9999 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:56 PM.


Advertisement
Log in to turn off these ads.