| | |
Want to change color on click!?
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Dec 2004
Posts: 2
Reputation:
Solved Threads: 0
I am displaying data in a table on one of my web pages. When the user clicks on a row, I want that row ONLY to change color. I'd settle for that cell. I have a css file referenced on the page with two styles, td_on and td_off, which have same settings except for the background colors. I put the "class" tag in the td like so: <td align="center" class="td_off" >
I have tried to use the onclick action to change the class to the td_on style like so, onclick="class=td_on" but this does NOT cause any changes. Can someone tell me what the proper syntax for doing this is ... or maybe an easier way to accomplish what I want???!
TIA
I have tried to use the onclick action to change the class to the td_on style like so, onclick="class=td_on" but this does NOT cause any changes. Can someone tell me what the proper syntax for doing this is ... or maybe an easier way to accomplish what I want???!
TIA
Maybe u could try onclick="id='td_off'" . I'm not exacly shure if it is the write sintax, maybe it has to be something infront of " style='td_of' ", like TD or something. But I think this works.I'm new here to!
Try and reply!
Ok I tried it myselfe and the only problem is vith IE couse u have to alow a "popup" if u wont it to work.
Firefox goes OK! :o
Try and reply!
Ok I tried it myselfe and the only problem is vith IE couse u have to alow a "popup" if u wont it to work.
Firefox goes OK! :o
Last edited by pajac; Jan 23rd, 2005 at 11:58 am. Reason: I'm stupid!!
•
•
•
•
Originally Posted by vcombs
I am displaying data in a table on one of my web pages. When the user clicks on a row, I want that row ONLY to change color. I'd settle for that cell. I have a css file referenced on the page with two styles, td_on and td_off, which have same settings except for the background colors. I put the "class" tag in the td like so: <td align="center" class="td_off" >
I have tried to use the onclick action to change the class to the td_on style like so, onclick="class=td_on" but this does NOT cause any changes. Can someone tell me what the proper syntax for doing this is ... or maybe an easier way to accomplish what I want???!
TIA
This should be your TD in your HTML:
HTML and CSS Syntax (Toggle Plain Text)
<td class="out" onMouseOver="this.className='over'" onMouseOut="this.className='out'"><a href="page.php">LINK</a></td>
Then in your stylesheet:
HTML and CSS Syntax (Toggle Plain Text)
.over { background-color:#D0C0A9; padding-top: 2px; padding-bottom:2px;} .out { background-color: #E1D4C0; padding-top: 2px; padding-bottom:2px;}
That should do it for ya!
Let me know if you have problems, I'd be glad to help.
Shannon
Second Platform
Web Design in Wisconsin : Milwaukee Web Design : Second Platform
•
•
Join Date: Apr 2009
Posts: 1
Reputation:
Solved Threads: 0
•
•
•
•
I am displaying data in a table on one of my web pages. When the user clicks on a row, I want that row ONLY to change color. I'd settle for that cell. I have a css file referenced on the page with two styles, td_on and td_off, which have same settings except for the background colors. I put the "class" tag in the td like so: <td align="center" class="td_off" >
I have tried to use the onclick action to change the class to the td_on style like so, onclick="class=td_on" but this does NOT cause any changes. Can someone tell me what the proper syntax for doing this is ... or maybe an easier way to accomplish what I want???!
TIA
•
•
Join Date: Apr 2009
Posts: 3
Reputation:
Solved Threads: 0
Here are some cool JavaScript solutions:
- http://cssglobe.com/lab/tablecloth/
- http://www.frequency-decoder.com/demo/table-actions/
- http://www.flexigrid.info/
![]() |
Similar Threads
- change the color for DBGrid row; Input Validation code help!! (Visual Basic 4 / 5 / 6)
- Change Color dataGridView (C++)
- GridView Change Color to Column Values (ASP.NET)
- How to change color of a row (Java)
- How to change the color of selected row of an HTML table without using CSS or Javascr (VB.NET)
- change color of border (Visual Basic 4 / 5 / 6)
Other Threads in the HTML and CSS Forum
- Previous Thread: Spry Vertical Menu in IE6
- Next Thread: Positioning Elements using CSS/DHTML
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7





