-
Dynamic Text Color
I'm trying to set up a text based nav bar with links that
change color when you pass the mouse over them. This seems
relatively straightforward to do in IE. In this case,
the link element references a predefined CSS and calls a
simple javascript function with a reference to itself:
onMouseOver="highlight(this)"
The javascript function changes the color attribute of
the link text:
function highlight(button) {
button.style.color = "white";
}
This looks almost as good as a graphics based nav bar but
loads much faster.
I have yet to figure out how to do this in Netscape.
Any help????
-
Re: Dynamic Text Color
In NS 4.x you can't do it this way.
(IE supports the "hover" CSS attribute, with which you don't need a javascript
to accomplish the effect.
But NS 4.x doesn't support hover.)
Here is an exemple I once found, that does work:
<html>
<head>
<SCRIPT LANGUAGE="JavaScript"><!--
function high(what,text) {
changeContent(what,'<DIV STYLE="color:red;">' + text + '<\/DIV>');
}
function low(what,text) {
changeContent(what,text);
}
function changeContent(what,text) {
if (document.layers) {
what.document.open();
what.document.write(text);
what.document.close();
}
}
//--></SCRIPT>
</head>
<body bgcolor="#ffffff">
<P>
<DIV onMouseOver="this.style.color='red'" onMouseOut="this.style.color='black'">
<LAYER onMouseOver="high(this,'Move the mouse pointer over this text')"
onMouseOut="low(this,'Move the mouse pointer over this text')">
Move the mouse pointer over this text
</LAYER>
</DIV>
</P>
</body>
</html>
cya
Frederiek
"David Maggiano" <david_maggiano@qwest.net> wrote:
>
>I'm trying to set up a text based nav bar with links that
>change color when you pass the mouse over them. This seems
>relatively straightforward to do in IE. In this case,
>the link element references a predefined CSS and calls a
>simple javascript function with a reference to itself:
>
> onMouseOver="highlight(this)"
>
>The javascript function changes the color attribute of
>the link text:
>
> function highlight(button) {
> button.style.color = "white";
> }
>
>This looks almost as good as a graphics based nav bar but
>loads much faster.
>
>I have yet to figure out how to do this in Netscape.
>
>Any help????
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|