|
|
Please consider registering: registration is fast, easy and free! Benefits of registration:
- Free advertising for your website: Every post in our forums goes towards a "credit" of ads, which are displayed on most pages of our forums. Each post gives you 400 ad impressions. To submit your ad, edit your profile.
- Discount at TemplateMonster: All our members enjoy a 10% discount at TemplateMonster.com!
|
- Private Messages: Exchange private messages with other members of the forums.
- Message Tracking/Subscription: phpBB enables you to subscribe to threads which interest you, and will then email you when a reply is posted. phpBB also remembers which posts registered users have read during a session, which means you can keep track of which posts you have already looked at.
|
|
| Author |
Message |
Andilinks
Junior WebHelper

Joined: 24 Sep 2003
Posts: 1
Location: USA
|
Posted:
Wed Sep 24, 2003 5:40 am (9 years, 8 months ago) |
  |
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:
| Code: | <TR><TD class="class1">
content
</TD></TR>
|
and this
| Code: | <TR><TD class="class2">
content
</TD></TR>
|
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:
| Code: | function toggleClassName(obj, class1, class2){
obj= getRef(obj);
// obj.isClass1 will be false the first time.
if(!obj.isClass1){
obj.className= class1;
obj.isClass1= true;
}
else{
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.
Andi |
|
|
     |
 |
|
|
|
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.025999 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
| |