Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 19th, 2005, 07:07 AM
Authorized User
 
Join Date: Dec 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default .syntax not working with class

I thought one could access attribute properties with . syntax, but not so with class?

I captured several tags by there ids

z.B. firstRef = docPath.getElementById("row0");

but firstRef.class doesn't work, but firstRef.attributes[3].nodeValue returns "rowColourDark" and firstRef.attributes[3].nodeName returns "class"

firstRef.attributes[3].specified returns "true" so why can't I access the class value with . syntax like I can access ID etc., etc.

 
Old January 19th, 2005, 07:09 AM
Authorized User
 
Join Date: Dec 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Using latest version of IE on windows xp.

I don't mind changing and reading class values with the attributes array as long as the element number is constant, is it always 3?

 
Old January 19th, 2005, 07:15 AM
Authorized User
 
Join Date: Dec 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Incase it matters, the html was created with php which pulled data from an xml file and created a table. I don't think this should matter as I can capture tags by there ID and manipulate input fields with javascript so I should be able to access the class with . syntax I think.

 
Old January 19th, 2005, 07:21 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

in script u need to use className not class to capture this attribute - it was done like this because class is a reserved word in many languages





Similar Threads
Thread Thread Starter Forum Replies Last Post
class names in xslt not working chobo XSLT 2 January 13th, 2008 02:43 AM
EventUtil class not working in web server KelRegor BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 2 December 26th, 2007 09:50 AM
Regarding Class Library (.dll) from class file manish.sharma04 BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 1 March 3rd, 2006 07:32 AM
Working with a class absolutezero Classic ASP Basics 0 August 18th, 2005 11:30 PM
How to include c# class and vb class in the .vbprj umeshayk VS.NET 2002/2003 2 January 9th, 2004 12:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.