Coding Thread, HTML Table, change cell colour on value entered in Coding and Web Development; Hello,
This is probably very easy for web developers or coders out there but i aint got a clue, hope ...
-
15th December 2009, 03:48 PM #1
- Rep Power
- 0
HTML Table, change cell colour on value entered
Hello,
This is probably very easy for web developers or coders out there but i aint got a clue, hope someone can help.
I have an asp web page with a table. The table consists of 2 columns, target grade and now grade for each pupil for a subject.
A teacher will enter a target grade say 2, and then at a predetermined month enter the pupils actual "now" grade but instead of being easy and entering 2 or 1 or 3 or whatever they want to enter +1 or -1 or 0. This bit is fine.
The bit i need help for is this: depending on what value is entered in the table cell, the cell background colour is to change.
eg +1 = BLUE
0 = GREEN
-1 = RED
Can anyone help? I am thinking it might be an IF statement i need but i do not have a clue.
Heres the code i have so far: Thanks in advance!
h4><font color="#000000">English:</h4>
<table border="1">
<tr>
<th></th>
<th colspan="2">Dec S3</th>
<th colspan="2">Apr S3</th>
<th colspan="2">Nov S4</th>
<th colspan="2">Feb S4</th>
</tr>
<tr>
<td>Initial Target</td>
<td>Target</td>
<td>Now</td>
<td>Target</td>
<td>Now</td>
<td>Target</td>
<td>Now</td>
<td>Target</td>
<td>Now</td>
</tr>
<td><input type="text" style="font-family: Times New Roman; font-size: 14pt" size="4" name="engtarget" value="<%=RSlist2("engtarget")%>"</td>
<td><input type="text" style="font-family: Times New Roman; font-size: 14pt" size="4" name="edecs3t" value="<%=RSlist2("edecs3t")%>"</td>
<td><input type="text" style="font-family: Times New Roman; font-size: 14pt" size="4" name="edecs3n" value="<%=RSlist2("edecs3n")%>"</td>
<td><input type="text" style="font-family: Times New Roman; font-size: 14pt" size="4" name="eaprs3t" value="<%=RSlist2("eaprs3t")%>"</td>
<td><input type="text" style="font-family: Times New Roman; font-size: 14pt" size="4" name="eaprs3n" value="<%=RSlist2("eaprs3n")%>"</td>
<td><input type="text" style="font-family: Times New Roman; font-size: 14pt" size="4" name="enovs4t" value="<%=RSlist2("enovs4t")%>"</td>
<td><input type="text" style="font-family: Times New Roman; font-size: 14pt" size="4" name="enovs4n" value="<%=RSlist2("enovs4n")%>"</td>
<td><input type="text" style="font-family: Times New Roman; font-size: 14pt" size="4" name="efebs4t" value="<%=RSlist2("efebs4t")%>"</td>
<td><input type="text" style="font-family: Times New Roman; font-size: 14pt" size="4" name="efebs4n" value="<%=RSlist2("efebs4n")%>"</td>
<tr>
</table>
Miller
-
-
IDG Tech News
-
15th December 2009, 04:26 PM #2 gonna be a Javascript job, probably something along the lines of the following, in your input tag
onchange="if (this.value=='+1')this.className='bluebg';if (this.value=='-1')this.className='redbg';if (this.value=='0')this.className='greenbg';"
with bluebg, redbg and greenbg all set up as styles in your CSS with the appropriate backgrounds.
-
-
15th December 2009, 04:36 PM #3
-
SHARE:
Similar Threads
-
By PEO in forum EduGeek Joomla 1.5 Package
Replies: 1
Last Post: 13th February 2009, 01:21 AM
-
By DaveP in forum How do you do....it?
Replies: 12
Last Post: 19th January 2009, 01:43 PM
-
By RTi in forum EduGeek Joomla 1.5 Package
Replies: 1
Last Post: 8th October 2008, 01:01 PM
-
By park_bench in forum Coding
Replies: 4
Last Post: 30th June 2008, 08:52 AM
-
By wesleyw in forum How do you do....it?
Replies: 3
Last Post: 20th December 2006, 11:01 PM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules