On Thu, 8 Mar 2001, Salvatore Palmisano wrote: > Is it possible to apply text formatting on the fly, based on a user's mouse > click? > I have a series of radio buttons, and Id like when one is clicked on to set > some text to red, and when the other is clicked, the same text to black. > > Is this JS? DHTML? I have the CSS classes in place, but am at a loss about > how to call them client-side. > Thanks all. Technically, it's DTHML. Where the block-level element containing the text you want to change is called 'ThatBlock': IE: document.all["ThatBlock"].style.color = "#ff0000"; or document.all["ThatBlock"].style.color = "#000000"; W3C Clumsy: ChangeIt = document.getElementById("ThatBlock"); ChangeIt.style.color = "#ff0000"; // and so forth You can substitute the color codes with local variable names and put the scripting inside of a function that supplies the color codes as arguments: onclick="ChangeColor('#ff0000');" This is a generally clumsy example, but should be adequate as a starting point. Something else I should point out is that changing a single style attribute will not reset the other style values for that element, though the change *can* be expected to cascade where appropriate. ...And because I've never written anything to swap out entire classes, I can't be much help on the exact syntax for that approach (unless I spend 20 minutes at MSDN when I should be back in bed nursing my cold). HTH, -- Ben Henick Web Author At-Large http://www.io.com/persist1/ persist1 at io.com "Are you pondering what I'm pondering, Pinky?" "I think so, Brain, but... (snort) no, no, it's too stupid." "We will disguise ourselves as a cow." "Oh!" (giggles) "That was it exactly!"