How to change onmouseover and onmouseout dynamically

  • Thread starter Tor Inge Rislaa
  • 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
 
S

S. Justin Gengo

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
 
J

John Saunders

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...".
 
J

Jerry III

And remember to set Content-Script-Type, either in HTTP headers or through a
META tag...

Jerry
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top