Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > reading style value

Reply
Thread Tools

reading style value

 
 
Ward Germonpré
Guest
Posts: n/a
 
      12-14-2006
Hi,


I know you can position an element using a style property like so :

element.style.left=200px;

But how can you READ an elements style.left property ?



I want to position:fixed the columnheaders in a scrollable table an intend
to use this strategy:

First I dynamically construct the table, and when it's attached to the
document, I want to read the coordinates of the columnheaders and then
'fix' them using a different classname that I set up with 'position fixed'
in my stylesheet.

Can this work ?

thx

Ward
 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      12-14-2006
Ward Germonpré wrote on 14 dec 2006 in comp.lang.javascript:
> I know you can position an element using a style property like so :
>
> element.style.left=200px;


No, it should be a string!

element.style.left='200px';

Only usefull if the element has an absolute/relative position, methinks.

> But how can you READ an elements style.left property ?


alert( element.style.left );

> I want to position:fixed the columnheaders in a scrollable table an
> intend to use this strategy:


eh?

Please show a scarce example code.

> First I dynamically construct the table, and when it's attached to the
> document, I want to read the coordinates of the columnheaders and then
> 'fix' them using a different classname that I set up with 'position
> fixed' in my stylesheet.
>
> Can this work ?


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
 
 
 
Matt Kruse
Guest
Posts: n/a
 
      12-15-2006
Ward Germonpré wrote:
> I want to position:fixed the columnheaders in a scrollable table an
> intend to use this strategy:


Creating cross-browser locked table header code is tricky. I prefer to
separate the IE world from the rest of the world, and use stuff like this:
http://www.javascripttoolbox.com/lib/scrollingdatagrid/

It might provide a few ideas, at least

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com


 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataGrid header style inconsistent with sortable column style cedoucette@alum.rpi.edu ASP .Net 0 10-14-2005 12:13 AM
All style tags after the first 30 style tags on an HTML page are not applied in Internet Explorer Rob Nicholson ASP .Net 3 05-28-2005 03:11 PM
Need help with Style conversion from Style object to Style key/value collection. Ken Varn ASP .Net Building Controls 0 04-26-2004 07:06 PM
Javascript Style Switcher that remebers current site style in use Hardeep Rakhra HTML 8 01-15-2004 08:00 PM
Style sheets, include one style within another (not inheritance) foldface@yahoo.co.uk HTML 1 11-24-2003 01:37 PM



Advertisments