Need help with hyperlink mouseover

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
 
E

e

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>
 
W

wazoo

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.
 
H

Herfried K. Wagner [MVP]

* "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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top