Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Cross browser compatibility using offsetWidth

Reply
Thread Tools

Cross browser compatibility using offsetWidth

 
 
parksch2@hotmail.com
Guest
Posts: n/a
 
      05-15-2005
I know there are a lot of articles out there about this subject but I
have been reading for 3 hours and still can't find the answer. I have
some text in a bunch of hidden spans. I need to find the width in
pixels of that text. Using offsetWidth gives me a different value when
viewed in IE and Firefox. I need those to sync up somehow. I have tried
innerWidth, clientWidth, scrollWidth, etc. Any ideas?

Thanks in advance!

 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      05-16-2005


http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> I know there are a lot of articles out there about this subject but I
> have been reading for 3 hours and still can't find the answer. I have
> some text in a bunch of hidden spans. I need to find the width in
> pixels of that text. Using offsetWidth gives me a different value when
> viewed in IE and Firefox.


Why not, browsers can have different defaults for font-family and
font-size, padding, margin, the browser windows can have different
dimenisions. In one browser window element.offsetWidth should give you
the correct pixel width for that element but don't expect to get the
same value in another browser window.


--

Martin Honnen
http://JavaScript.FAQTs.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
Cross-browser compatibility of Asp.net v.1.1 & 2.0 =?Utf-8?B?cHJvZl9tYXJ0aW4=?= ASP .Net 1 04-25-2006 01:01 PM
Cross-browser compatibility of Asp.net 2.0 dejavue82@yahoo.com ASP .Net 7 03-15-2006 03:42 AM
Compatibility problems with offsetParent and offsetWidth Ned Baldessin Javascript 1 03-03-2005 01:23 AM
Problems with cross browser compatibility Sally Thompson HTML 8 06-19-2004 10:40 AM
cross browser compatibility jb HTML 16 12-08-2003 06:34 PM



Advertisments