Hmm... not sure about a tutorial, but adapting Patrick Griffaths DOM
example for avoiding email spam at
http://www.htmldog.com/ptg/archives/000063.php

would give something like:

function changeClass(id, newclass){

  elementToChange = document.getElementById(id);
  elementToChange.setAttribute("class", newclass);
  
}

Then you'd need to associate this function with the element/event that
you want to use... such as:

document.getElementById("myMenuItem").onmouseover = function(){
changeClass("myMenuItem", "thenewclassname")}

Actually, with the last bit I'm not too sure whether I'm mixing my old
JS habits with proper DOM coding... perhaps someone more knowledgable
can check it when they read this!

Hope it helps!
-Michael.

On Sat, 2004-09-04 at 07:42, Seona Bellamy wrote:
> Hi guys,
> 
> Anyone know where I can find a good, easy to follow online tutorial on using
> the DOM to control elements on a webpage? Specifically, I need to change the
> class of an element to a different class.
> 
> Cheers,
> 
> Seona.
> 
> __________________________________________________________________
> << ella for Spam Control >> has removed Spam messages and set aside Later
> for me
> You can use it too - and it's FREE!  http://www.ellaforspam.com
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.749 / Virus Database: 501 - Release Date: 1/09/2004
> 
> 
> ******************************************************
> The discussion list for  http://webstandardsgroup.org/
> 
> Proud presenters of Web Essentials 04 http://we04.com/
>  Web standards, accessibility, inspiration, knowledge
> To be held in Sydney, September 30 and October 1, 2004
> 
>  See http://webstandardsgroup.org/mail/guidelines.cfm
>  for some hints on posting to the list & getting help
> ******************************************************
> 

******************************************************
The discussion list for  http://webstandardsgroup.org/

Proud presenters of Web Essentials 04 http://we04.com/
 Web standards, accessibility, inspiration, knowledge
To be held in Sydney, September 30 and October 1, 2004

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
******************************************************

Reply via email to