TRCOLOR stuff. Works with tables and mouse overs. Scroll down for example of mouseover.
TABLE EXAMPLE:
When surfers fill out the below form, it will change to a light green color as they move from field to field.
| Name: |
| Address: |
| and more stuff: |
Here is how it works:
1. Put this javascript code in the head of your page:
<script type="text/javascript" language="JavaScript">
function trColor(elementId){
if (document.getElementById) {
document.getElementById(elementId).style.backgroundColor="#ccffcc"}
}
function trColorOff(elementId) {
if (document.getElementById) {
document.getElementById(elementId).style.backgroundColor=""}
}
</script>
Note: to change the color from light green, just change the value in line 3 of the function trColor
2. For each Table Row, put an ID section use simple names like row1, row2 etc.
<TR id="row1">
3. The input tag needs these parameters:
onFocus="trColor('row1')" onBlur="trColorOff('row1')"
NOTICE the ID name used as the value passed to the functions. also notice the use of single and double quotes (normal PHP stuff)
MOUSEOVER EXAMPLE 1:
When you put your mouse over any part of these paragraphs, it will change to the same color as the above table. The preferred method would be to put it inside a span or div tag so you can use more than one paragraph.
This paragraph should be colored light green also when the mouse is over any of the sample text.
How this one works:
<div id="div1" onMouseOver="trColor('div1')" onMouseOut="trColorOff('div1')">
MOUSEOVER EXAMPLE 2:
Place this code inside the div or span tag as you did above,
CHANGE the color in line 3 of divColor()
CHANGE the id tag and the parameter name passed in each function to match the new ID.