FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 toggling css classes
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
Junior WebHelper
Junior WebHelper

Joined: 24 Sep 2003
Posts: 1
Location: USA

PostPosted: Wed Sep 24, 2003 5:40 am (18 years, 1 month ago) Reply with QuoteBack to Top

Hi I'm Andi, I'm new here and definitely a newbie with Javascript, though I have done a few things with it on my site over the last 18 months. I don't really *want* to take the time learn js coding for the few times I need it. I have enough trouble keeping up with VB.

Not being a web designer I often am referring to books, sites, and source code files to effect the design I want for my one and only site.
Usually that works, but this one has me puzzled for now, I have spent some time copying things from the css Zen Garden site, but I'm obviously missing something.

Here's the question:

How can I place a link or button within a <TD> cell that toggles the class of that cell?

I want to toggle between this:

<TR><TD class="class1">



and this
<TR><TD class="class2">



I have found this script at dhtmlkitchen.com, which seems to be what I want, but but I don't know how to implement it with a button or link:

function toggleClassName(obj, class1, class2){
    obj= getRef(obj);
        // obj.isClass1 will be false the first time.
        obj.className= class1;
        obj.isClass1= true;
        obj.className= class2;
        obj.isClass1= false;

Any help would be appreciated. I am going to use this to toggle between columns and rows of text presentation, I have already worked out the css details on the two different classes for doing that, it is the toggling script itself that has me stumped.

OfflineView User's ProfileFind all posts by AndilinksSend Personal MessageVisit Poster's Website
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic

 Jump to:   

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.

Page generation time: 0.149659 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme