Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to highlight/bold/change color/font in mouseover event

Status
Not open for further replies.

kanank

MIS
Oct 26, 2004
5
0
0
US
Hi,
I am not sure how to change the text's color (href link) to red during the mouseover event. here is an example:
<html>
<title> SOLUTIONS Metrics Help</title>
<head>
</head>
<body>
<script LANGUAGE="vbscript">
sub displaymsg

end sub
</script>
<ol>
<li><a onmouseover="displaymsg()" href="AdjAPL.htm" target=adjapl><b>Adjusted APL</a></li>
<li> <a href="AplDemoH.htm" target=apldemo>APL Demographics</a></li>
</ol>
</body>
</html>

I would like to the href in bold or different color or/and may be bigger size font during the mouseover event.

thanks
Kanan
 
You could do it this way:

<div onmouseover="this.style.color='red'" onmouseout="this.style.color='black'" onclick="window.open('AdjAPL.htm')"><b>Adjusted APL</b></div>

There are many ways to accomplish what you asked, though.
 
Or, if you wanted to use a function, you could:

<script language="vbscript">

Sub displaymsg(whichdiv, color)

whichdiv.style.color=color
If LCase(color)="black" Then
whichdiv.style.fontweight="normal"
Else
whichdiv.style.fontweight="bold"
End If

End Sub

</script>

<div onmouseover="displaymsg(this,'red')" onmouseout="displaymsg(this,'black')" onclick="window.open('AdjAPL.htm')"><b>Adjusted APL</b></div>

You can also accomplish the same thing using style sheets and hover.
 
Hello all,

It simplifies thing if openly embrass msie outright for an intranet... usage. In that case, I think, it is rather "me" than "this".
[tt]
<li><a onmouseover="displaymsg([blue]me[/blue],'red')" onmouseout="displaymsg([blue]me[/blue],'black')" href="AdjAPL.htm" target=adjapl><b>Adjusted APL</a></li>
[/tt]
with the sub
[tt]
sub displaymsg(obj,scolor)
obj.style.color=scolor
end sub
[/tt]
regards - tsuji
 
You can't use parentheses when you call a VBScript Sub. So it would be:

<a onmouseover="displaymsg me,'red'" onmouseout="displaymsg me,'black'" href="AdjAPL.htm" target=adjapl><b>Adjusted APL</a>
 
Quite so, trollacious. My oversight.

- tsuji
 
thanks everybody for your replies. It was really useful.
great tips!
kanan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top