This syntax isn't correct:
Code:
textcontainerobj.filters.alpha.opacity=degree
Even if it were, there is no filter on the textcontainerobj.
It gets worse though because if you use the right syntax and have the alpha filter already on the textcontainerobj it will look bad in IE 7. IE 7 doesn't do filters on text very well.
With that said, here's a version that works:
Code:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
#mail
{
display: block;
float: left;
display: inline;
width: 50px;
height: 50px;
background: url("../images/menu/blackrolloverbutton.gif") no-repeat 0 0;
}
#mail:hover
{
background-position: 0 -50px;
}
#mail span
{
display: none;
}
#blog
{
display: block;
float: left;
display: inline;
width: 50px;
height: 50px;
background: url("../images/menu/bluerolloverbutton.gif") no-repeat 0 0;
}
#blog:hover
{
background-position: 0 -50px;
}
#blog span
{
display: none;
}
#tabledescription{
font-family: Arial, Helvetica, sans-serif;
font-size: 18px;
color: #990033;
text-decoration: underline;
filter:progid:DXImageTransform.Microsoft.alpha(opacity=100);
zoom:100%;
}
</style>
<script type="text/javascript">
var baseopacity=0
function showtext(thetext){
if (!document.getElementById)
return
textcontainerobj=document.getElementById("tabledescription")
browserdetect=textcontainerobj.filters? "ie" : typeof textcontainerobj.style.MozOpacity=="string"? "mozilla" : ""
instantset(baseopacity)
document.getElementById("tabledescription").innerHTML=thetext
highlighting=setInterval("gradualfade(textcontainerobj)",50)
}
function hidetext(){
cleartimer()
instantset(baseopacity)
}
function instantset(degree){
if (browserdetect=="mozilla")
textcontainerobj.style.MozOpacity=degree/100
else if (browserdetect=="ie")
textcontainerobj.filters[0].opacity=degree
else if (document.getElementById && baseopacity==0)
document.getElementById("tabledescription").innerHTML=""
}
function cleartimer(){
if (window.highlighting) clearInterval(highlighting)
}
function gradualfade(cur2){
if (browserdetect=="mozilla" && cur2.style.MozOpacity<1)
cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+0.2, 0.99)
else if (browserdetect=="ie" && cur2.filters[0].opacity<100)
cur2.filters[0].opacity+=20
else if (window.highlighting)
clearInterval(highlighting)
}
</script>
</head>
<body>
<table width="252" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="252" height="55" valign="top">
<a href="http://www.a.com" id="mail" onMouseover="showtext('JavaScript tutorials and scripts!')" onMouseout="hidetext()"></a>
<a href="http://www.b.com" id="blog" onMouseover="showtext('300+ free JavaScripts')" onMouseout="hidetext()"></a>
<a href="http://www.c.com" id="mail" onMouseover="showtext('Comprehensive JavaScript Reference')" onMouseout="hidetext()"></a>
<a href="http://www.d.com" id="blog" onMouseover="showtext('Web coding and development forums!')" onMouseout="hidetext()"></a>
<a href="http://www.e" id="mail" onMouseover="showtext('Award winning DHTML and JavaScripts')" onMouseout="hidetext()"></a>
</td>
</tr>
<tr>
<td height="19" align="center" valign="top"><div id="tabledescription">Click buttons above!</div></td>
</tr>
</table>
</body>
</html>
What I would suggest though is, instead of fading the text in and out, place an image or a division with a solid background over the text and fade it out and in.
Bookmarks