Need help with hyperlink mouseover

  • Thread starter Thread starter wazoo
  • Start date Start date
W

wazoo

I'm hoping someone here might help me with this.

I'm putting the finishing touches on my intranet web app, and I'm adding
some simple JavaScript to my VB.Net Webforms.

This works:
Button1.Attributes.Add("onmouseover", "this.style.backgroundColor=""Blue""")
Button1.Attributes.Add("onmouseout", "this.style.backgroundColor=""Navy""")

And this works:
Hyperlink1.Attributes.Add("onmouseover", "this.style.fontWeight=""Bold""")
Hyperlink1.Attributes.Add("onmouseout", "this.style.fontWeight=""Normal""")

But this doesn't:
Hyperlink2.Attributes.Add("onmouseover", "this.style.COLOR=""Blue""")
Hyperlink2.Attributes.Add("onmouseout", "this.style.COLOR=""Navy""")

I'd like the hyperlink text to sort of "glow" by changing the font to the
lighter color, but it does nothing. I've hacked at it for an hour or so and
tried .color, .forecolor, .foreground, .foregroundcolor, .fontcolor, and so
on. . . I googled for example code and found plenty, but none just changing
the font color.

So either this simply can't be done this way, or I need a clue.

TIA
 
This is essentially a JavaScript syntax problem and not a vb.net issue.
JS is case sensitive, that's why the 3rd of your examples doesn't work.
COLOR isn't a property of the style class, but color is. For <A> tags, you
could use the A and A:hover styles to save you some time inserting java
properties into all your hyperlink objects:

<style type="text/css">
A { color: blue; background-color: white; text-decoration: underline }
A:hover { color: white; background-color: blue; text-decoration: none }
</style>
 
Actually "COLOR" was typed for emphasis, I was typing "Color" - still
incorrect, and for the same reason.

But, thanks: "color" - of course - works. CSS will need to wait for the
next project, I need to get this one off my desk.
 
* "wazoo said:
I'm hoping someone here might help me with this.

I'm putting the finishing touches on my intranet web app, and I'm adding
some simple JavaScript to my VB.Net Webforms.

This works:
Button1.Attributes.Add("onmouseover", "this.style.backgroundColor=""Blue""")
Button1.Attributes.Add("onmouseout", "this.style.backgroundColor=""Navy""")

You may want to turn to the ng for ASP.NET Web Controls questions for future
ASP.NET Web Control related questions:

<
Web interface:

<http://msdn.microsoft.com/newsgroup...ft.public.dotnet.framework.aspnet.webcontrols>
 
Back
Top