PDA

View Full Version : little help with javascript and different browsers?


terptown
03-06-2002, 06:03 PM
not that great at determining the different browsers capability when it comes to javascript but would anybody be able to tell me if this is possible or can help me fix it...
thanks, ryan

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>

<body>

<script language="JavaScript1.2">
function setBackgroundColor(id, bgcolor)
{
if(document.all)
{
document.all[id].style.BackgroundColor = bgcolor;
}
else if(document.layers)
{
document.layers[id].BackgroundColor = bgcolor;
}
else(document.getElementById)
{
document.getElementById(id).style.BackgroundColor = bgcolor;
}
}
</script>
<table border="0" cellpadding="0" cellspacing"0">
<tr>
<td id="TestLayer" width="200" height="20" bgcolor="#CCCCCC" onMouseOver="setBackgroundColor('TestLayer','#333333')" onMouseOut="setBackgroundColor('TestLayer','#cccccc')">hello world</td>
</tr>
</table>
</body>
</html>