Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Applying CSS style to DHTML 1

Status
Not open for further replies.

mcowen

Programmer
Oct 21, 2001
134
GB
Hello,

I cant seem to apply a style to a table cell I have added dynamically using the DOM functions. I try the following...

var t3r2 = document.createElement("td");
t3r2.setAttribute( "height", "12" );
t3r2.setAttribute( "valign", "top" );
var typelink = document.createElement("a");
typelink.setAttribute("href","#");
typelink.setAttribute("class","toptablecell");
addEvent( typelink, "onclick", showTransactionTypeForMember, false );

I use the 'toptablecell' css style successfully in other non dynamic portions of the page. How can I add this style properly?

Thanks
Matt

Matt
 
typelink.setAttribute("className","toptablecell");

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
Thanks for that. Do you know of an online resource that lists all these DOM attribute names please? I thought they were the same as the HTML element attribute names but obviously not.

Matt
 
hmm - I've kind of picked them up as I go...

might be helpful

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top