Forum Moderators: open
I use some simple code for a menu script to make text hi-lighted and low-lighted IE5,6 and 7 has NO problem, but FF...... Keeps the text invisible.
This is the Java script I use:
<SCRIPT Language="javascript">
var browser_string1 = "";
var browser_string2 = "";
if (document.layers) {// navigator
browser_string1 = "layers.";
browser_string2 = "";
} else if (document.all) {// ie
browser_string1 = "all.";
browser_string2 = ".style";
} else {// FF;
browser_string1 = "getElementById.";
browser_string2 = ".style";
}
function highlight(tekstid) {
if (document.all) {
eval("document." + browser_string1 + tekstid + browser_string2 + ".color = '000000'");
}
}
function lowlight(tekstid) {
if (document.all) {
eval("document." + browser_string1 + tekstid + browser_string2 + ".color = 'cccccc'");
}
}
</SCRIPT>
And the html:
<TR>
<TD width=1>
</TD>
<TD BGCOLOR="F2F2F2" width=8 >
</TD>
<TD BGCOLOR="F2F2F2" width=153 align=right>
<FONT SIZE=3 FACE="VERDANA">
<B>
<A HREF="home.php" TARGET="home"
OnMouseOver="highlight('tekst1')"
OnMouseOut="lowlight('tekst1')">Home</A></B>
</font>
</TD>
<TD BGCOLOR="F2F2F2" width=8>
</TD>
</TR>
<TR>
<TD width=1>
</TD>
<TD BGCOLOR="F2F2F2" width=8 >
</TD>
<TD VALIGN=TOP BGCOLOR="F2F2F2" width=153 align=right>
<FONT SIZE=2 FACE="VERDANA" COLOR="F2F2F2">
<DIV ID="tekst1">
Home
<BR>
</DIV>
</font>
</TD>
<TD BGCOLOR="F2F2F2" width=8>
</TD>
</TR>
<TR>
<TD width=1>
</TD>
<TD width=8 height=5>
</TD>
</TR>
<TR>
<TD width=1>
</TD>
<TD BGCOLOR="F2F2F2" width=8 >
</TD>
<TD BGCOLOR="F2F2F2" width=153 align=right>
<FONT SIZE=3 FACE="VERDANA">
<B>
<A HREF="home.php" TARGET="home"
OnMouseOver="highlight('tekst2')"
OnMouseOut="lowlight('tekst2')">Onze aanpak</A></B>
</font>
</TD>
<TD BGCOLOR="F2F2F2" width=8>
</TD>
</TR>
<TR>
<TD width=1>
</TD>
<TD BGCOLOR="F2F2F2" width=8 >
</TD>
<TD VALIGN=TOP BGCOLOR="F2F2F2" width=153 align=right>
<FONT SIZE=2 FACE="VERDANA" COLOR="F2F2F2">
<DIV ID="tekst2">
Het traject
<BR>
</DIV>
</font>
</TD>
<TD BGCOLOR="F2F2F2" width=8>
</TD>
</TR>
etc etc
Please
Keeping it simple, you can replace your entire SCRIPT section (and your 2 functions) with:
<script type="text/javascript">
function highlight(tekstid) {
document.getElementById(tekstid).style.color = '#000';
}
function lowlight(tekstid) {
document.getElementById(tekstid).style.color = '#ccc';
}
</script>
Hope that helps, if you need any further explanation just say.
...welcome to WebmasterWorld! :)