Current location: Hot Scripts Forums » General Web Coding » HTML/XHTML/XML » Changing a color on a table row one at a time.


Changing a color on a table row one at a time.

Reply
  #1 (permalink)  
Old 02-23-04, 10:49 AM
mtilori mtilori is offline
New Member
 
Join Date: Feb 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Changing a color on a table row one at a time.

I have a table that contains name and address data. When a row is clicked I want to change the backgound color (blue) of that row. (I have this working). If another row is clicked I want to change the background color of the previous row clicked to the original color (white) and change the new row clicked to blue. Any help would be appreciated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 02-23-04, 02:30 PM
gordypordy gordypordy is offline
Newbie Coder
 
Join Date: Feb 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by mtilori
I have a table that contains name and address data. When a row is clicked I want to change the backgound color (blue) of that row. (I have this working). If another row is clicked I want to change the background color of the previous row clicked to the original color (white) and change the new row clicked to blue. Any help would be appreciated.

I am presuming that these 'rows' you are speaking about are actually links.

If so there are several different ways you can accomplish this, either directly into the HTMl coding or by Style Sheet (CSS) if you use it. If not, we can create one.

If you have a link to the page where you are trying to achieve this, that would be helpful, if not, just copy and paste what you have done of the table so far, in here.

If you simply wish to have the different colors incorporated into the table, that is just as simple.
What to remember is that TABLES consist of DATA CELLS which are identified within the tags <TD> </td> , within these tags you can set a variety of parameters, such as width, color, alignment etc., whilst also having an overall background color for the table, or no color at all!

Give me some more info and we'll see what we can do.
__________________
<a href="http://www.one2search.org">$6.97 domain registration</a>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 02-24-04, 04:50 PM
mtilori mtilori is offline
New Member
 
Join Date: Feb 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for your reply...Here is my code

"colorOne" is white background
"colorTwo" is blue background

Again the problem is that if I click on multiple rows I am getting all the rows clicked blue. I only want one blue row at a time.


<form name="<%=formName%>" method="post" action="processMainBrowseTableClick.jsp">

<tr class="colorOne" onClick="className='colorTwo';">

<td align=left width=8% >
<input type=hidden name="clientID" value="<%=caseIndividualElement.getClientID()%>"/>
<input type=hidden name="addressID" value="<%=caseIndividualElement.getAddressID()%>"/>
<input type=hidden name="caseID" value="<%=caseIndividualElement.getCaseID()%>"/>
<input type=hidden name="caseName" value="<%=caseIndividualElement.getCaseName()%>"/>
<a href="javascript:void(null);" onClick="document.<%=formName%>.submit();" class="table" ><%=caseIndividualElement.getCaseName()%></a>
</td>

<td align=left width=8% >
<input type=hidden name="clientID" value="<%=caseIndividualElement.getClientID()%>"/>
<input type=hidden name="addressID" value="<%=caseIndividualElement.getAddressID()%>"/>
<input type=hidden name="caseID" value="<%=caseIndividualElement.getCaseID()%>"/>
<input type=hidden name="caseName" value="<%=caseIndividualElement.getCaseName()%>"/>
<a href="javascript:void(null);" onClick="document.<%=formName%>.submit();history.g o(0);" class="table" ><%=caseIndividualElement.getWholeName()%></a>
</td>

</tr>
</form>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 02-24-04, 05:27 PM
gordypordy gordypordy is offline
Newbie Coder
 
Join Date: Feb 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Do you have a link to where this script is, so that I can see more clearly what it is you are attempting to achieve.

Reading the script of itself doesn't quite do that for me.

It may well be that all that is required is for you to insert the coding from your Table Row (TR) tags into the Table Data cells (TD) tag, where it would normally go. Try that, if it doesn't work, give me a link so I can see the visual output.
__________________
<a href="http://www.one2search.org">$6.97 domain registration</a>

Last edited by gordypordy; 02-24-04 at 05:34 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
auto table resize derick_2k JavaScript 4 04-26-04 03:32 PM
Upload file to table so ONLY files tied to primary key are displayed in record? grafixDummy PHP 4 12-20-03 05:28 PM
strange grey "extra" table area... skyraider HTML/XHTML/XML 1 12-10-03 11:55 PM
Reduce the time intensive phases of .Net application development using TierDeveloper3 smars General Advertisements 0 12-02-03 06:15 AM
moving data from table to table ..please help! geneane ASP 2 09-22-03 08:02 PM


All times are GMT -5. The time now is 01:21 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.