How to change onmouseover and onmouseout dynamically

  • Thread starter Thread starter Tor Inge Rislaa
  • Start date Start date
T

Tor Inge Rislaa

Hi, I control the style of a button like the code below

Private Sub Change_Color()
Button1.Style("BACKGROUND-COLOR") = "#CEB57B"
Button1.Style("COLOR") = "White"
End Sub

How can I do the same with Button1's onmouseover and onmouseout style?

(Language VB.NET)

T.I.Rislaa
 
Tor,

Button1.Attributes.Add("onmouseover",
"javascript:this.style.color='White';this.style.background-color='#CEB57B';"
)

Button1.Attributes.Add("onmouseout", "javascript: ... ;")

Should do it for you.

(I'm not positive I've specified the styles properly. I'm borrowing the
format from a cursor change that I do:
"javascript:this.style.cursor='pointer';" but I'm pretty sure it will work.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
You don't want the "javascript:" unless you're putting the code into the
href attribute of an anchor tag. Just add "this.style.color...".
 
And remember to set Content-Script-Type, either in HTTP headers or through a
META tag...

Jerry
 
Back
Top