User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 391,969 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,097 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting

Accessing a class name?

Join Date: Jan 2008
Location: Bangalore, India
Posts: 327
Reputation: DangerDev is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 31
DangerDev's Avatar
DangerDev DangerDev is offline Offline
Posting Whiz

Re: Accessing a class name?

  #2  
Mar 7th, 2008
Hi
there is no direct way to get elements by class name.
but you can access the class name attribute using dom api:
take help of following example:
  1. <html>
  2. <head>
  3. <script>
  4. function clickMe()
  5. {
  6. var aElems=document.getElementsByTagName('a');
  7. var href=aElems[0].getAttribute('href');
  8. alert('href='+href);
  9. }
  10. </script>
  11. </head>
  12. <body>
  13. <a href="javascript:clickMe();">click</a>
  14. </body>
  15. </html>
as i have done for href you can do with class. Right !!!
A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila.
~Mitch Ratcliffe
Reply With Quote  
All times are GMT -4. The time now is 9:18 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC