...

View Full Version : Extracting HTML tag information



martyf
09-28-2005, 12:40 PM
Is it possible to extract out information from the HTML tag using JavaScript? For example, is it possible to extract the value of the 'lang' attribute from the HTML tag?

Any help would be appreciated.

Cheers,
Marty

Bill Posters
09-28-2005, 01:33 PM
document.getElementsByTagName('html')[0].lang

martyf
09-28-2005, 01:37 PM
Thanks mate... I had been doing it with 'Name' not 'TagName'... duh... many thanks indeed.
Marty

Bill Posters
09-28-2005, 01:45 PM
Thanks mate... I had been doing it with 'Name' not 'TagName'... duh... many thanks indeed.
Marty

Note also that it's getElements - i.e. plural

It creates an array. The [0] is used to select the first item in that array (javascript array indexes begin at 0).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum