Some JS Functions

3 views
Skip to first unread message

A. Shore

unread,
Jun 22, 2009, 11:54:25 PM6/22/09
to Open Source CAD - Dev
Here's a neat little JS function for those of you interested in doing
some dhtml.

Given an object (often a <div> or <span> plus a class (presumably
defined in your CSS) this will change its class. (It looks trivial,
but I can tell you I sweated many hours over this one before it
started to behave itself.)

function CngClass(obj, the_class){
$(obj).className=the_class;
}

I'll be using it to 'light up' buttons (change background color) in
the top frame under certain conditions, among other things. If you
haven't encountered function $() before, let me know and I'll provide
chapter and verse. Another jewel, IMO.

A
Reply all
Reply to author
Forward
0 new messages