avatar
c*o
1
How to make a asp.net button, whose background color will be changed on mouse
moving over it?
Acturally, the asp.net imageButton can do it, but a image must specified for
it. I don't want the overhead of loading images on my web pages. thanks!
avatar
m*n
2
do it when mouseover event of the button triggered?

mouse

【在 c*o 的大作中提到】
: How to make a asp.net button, whose background color will be changed on mouse
: moving over it?
: Acturally, the asp.net imageButton can do it, but a image must specified for
: it. I don't want the overhead of loading images on my web pages. thanks!

avatar
a*y
3
It's not hard to do it with the OnMouseOver event on server side. However,
you don't want to do it because it will take some time for it to be changed
because basically, you have to reload your page when your mouse is 'over' the
button.
I suggest you register some javascript code to make that change, by which the
change of color would be done on the fly at client side .
Eg:
Button1.Attributes.Add("onmouseover","alert('get out!')");

mouse

【在 c*o 的大作中提到】
: How to make a asp.net button, whose background color will be changed on mouse
: moving over it?
: Acturally, the asp.net imageButton can do it, but a image must specified for
: it. I don't want the overhead of loading images on my web pages. thanks!

avatar
c*o
4
Thank you. Your idea is good. Do you know some samples for it?

the
the
for

【在 a**y 的大作中提到】
: It's not hard to do it with the OnMouseOver event on server side. However,
: you don't want to do it because it will take some time for it to be changed
: because basically, you have to reload your page when your mouse is 'over' the
: button.
: I suggest you register some javascript code to make that change, by which the
: change of color would be done on the fly at client side .
: Eg:
: Button1.Attributes.Add("onmouseover","alert('get out!')");
:
: mouse

avatar
a*y
5
The included one is not good enough? :)
Button1.Attributes.Add("onmouseover","ButtonID.style.color='RED'");

However,
changed

【在 c*o 的大作中提到】
: Thank you. Your idea is good. Do you know some samples for it?
:
: the
: the
: for

avatar
c*o
6
It is good and works well. But I tried to changed the backgroundColor of the
button by using style.backcolor/bgcolor/background-color, neither work. Any
one know the reason? thank you!

'over'
which
on
specified
thanks!

【在 a**y 的大作中提到】
: The included one is not good enough? :)
: Button1.Attributes.Add("onmouseover","ButtonID.style.color='RED'");
:
: However,
: changed

avatar
a*y
7
style.background-color should work bah.

【在 c*o 的大作中提到】
: It is good and works well. But I tried to changed the backgroundColor of the
: button by using style.backcolor/bgcolor/background-color, neither work. Any
: one know the reason? thank you!
:
: 'over'
: which
: on
: specified
: thanks!

avatar
c*o
8
I thought it intuitively, unfortunately it didn't work. I am wondering the
button's background may not be changed on the fly because of HTML limitation
if any.

the
Any
changed

【在 a**y 的大作中提到】
: style.background-color should work bah.
avatar
s*i
9
1. Refresh, or
2. Invalidate

be
by

【在 c*o 的大作中提到】
: I thought it intuitively, unfortunately it didn't work. I am wondering the
: button's background may not be changed on the fly because of HTML limitation
: if any.
:
: the
: Any
: changed

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。