Getting a style name of a <div>

Javascript coding ..

Moderators: macek, egami, gesf

User avatar
Virtuoso
php-forum Active User
php-forum Active User
Posts: 268
Joined: Mon Jul 21, 2003 7:05 am
Contact:

Getting a style name of a <div>

Postby Virtuoso » Tue Sep 20, 2005 4:58 pm

How do I get the name of a style that the div is using.
For example

Code: Select all

<div style='headerdiv'>


How would I get the string headerdiv?

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Postby gesf » Fri Oct 07, 2005 9:13 pm

getElementById('div_name').style ??
Don't know... give it a try :D

User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Postby ruturajv » Sun Oct 16, 2005 9:06 pm

I guess you need the class name of the ID and not the style name
try this

Code: Select all

document.('div_name').class

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Postby gesf » Sun Oct 16, 2005 9:20 pm

That's it ruturajv :)
So the best way so far... document.getElementById('elem_name').whatever


Return to “JavaScript”

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest

cron