I am writing an little teaching aid for my daughter.
In a table I will show 5 rows of 2 columns. Column 1 will have an image of a
dog, cat, ball etc.. Column2 will have the text that matchs the images.
However, the two columns are in different order. The idea is to match the
picture of the ball to the text "Ball" in the second column.
I have all this working fine. However, once she makes a match I would like to
change the background-color of the cell that holds the text to pink (my five
year old's favorite color).
I already have an onClick statement to check to see if she has picked the text
that matches the image. If she is correct then a little Happy Face image that
displays on the screen. She clicks it, which hides it and continues to the
next image.
<td
onClick="if (item1 == '#items2[i]#')showhide('correct', 1); else
showhide('TryAgain', 1)">
What do I need to do to make the background of this cell pink if she answers
correctly?
Here is most of the code:
<body onLoad="javascript: showhide('correct', 0); showhide('TryAgain',0);">
<div id="correct" style="position: absolute; top: 100px; left: 150px;"><a
href="javascript:void(0)" onclick="javascript:showhide('correct', 0);"><img
src="/tests/images/happy.jpg" border="0"></a></div>
<div id="TryAgain" style="position: absolute; top: 100px; left: 150px;"><a
href="javascript:void(0)" onclick="javascript:showhide('TryAgain', 0);">Try
Again</a></div>
<table border="1" cellspacing="0" cellpadding="5">
<cfoutput>
<cfloop from="1" to="#ArrayLen(items)#" index="i">
<tr>
<td onClick="item1 ='#items[i]#'"><img
src="images/#items[i]#.gif"></td>
<td onClick="if (item1 ==
'#items2[i]#')showhide('correct', 1); else showhide('TryAgain',
1)"><strong>#items2[i]#</strong></td>
</tr>
</cfloop>
</cfoutput>
</table>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/cf_lists/message.cfm/forumid:5/messageid:211127
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:5
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5