|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
CSS table color link change
I am wondering what the code is for having the hover property of a link change the background color of the table?
|
|
#2
|
|||
|
|||
|
Here is one way
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript">
function changeBG(el,color)
{
document.getElementById(el).style.backgroundColor = color;
}
</script>
</head>
<body>
<p><a href="#" onmouseover="changeBG('mytable','#ff0000')">Click ME</a></p>
<table id="mytable" width="300" border="1" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
|
|
#3
|
|||
|
|||
|
One thing
The only problem with that is that when I roll out it still keeps the background color changed.
|
|
#4
|
|||
|
|||
|
You didn't say that you wanted it to change back.
onmouseout="...." |
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > CSS table color link change |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|