changing asp:button text on rollover

J

Jim in Arizona

using ASP.NET/VB.NET 2.0

I can change the text color of an ASP Button object on mouse
rollover/rollout by doing this (in page_load)

btnMyButton.Attributes.Add("onmouseover", "this.style.color='Yellow'")
btnMyButton.Attributes.Add("onmouseout", "this.style.color='White'")

But how can I change the text on rollover? I don't understand the javascript
DOM enough to know what to do. I did try:

btnMyButton.Attributes.Add("onmouseover", "this.text='My New Text'")

And Tried

btnMyButton.Attributes.Add("onmouseover", "this.style.text='My New Text'")

Of course, none of these do anything.

TIA,
Jim
 
M

Munna

Hi,,,,

asp.net button eventually turned in to html input when rendered to
browser...
just add simple java script to change the value of the button on mouse
over and out...

btnMyButton.Attributes.Add("onmouseover", "myfunction()'")

in page write a javascript...

function myfunction()
{
document.getelementbyid(''<%#=btnMybutton.clientid %>).value =
"somevalue";
}


BEST OF LUCK

--------------
Munna

www.munna.shatkotha.com/blog
www.munna.shatkotha.com
www.shatkotha.com
 

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

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,227
Latest member
Daniella65

Latest Threads

Top