读书人

ImageButton 鼠标经过时怎么换图片

发布时间: 2012-05-27 05:42:30 作者: rapoo

ImageButton 鼠标经过时如何换图片
ImageButton 鼠标经过时如何换图片。网上有方法在load里面加
ImageButton1.Attributes.Add("onmouseover", "this.src=images/a1.JPG ");
ImageButton1.Attributes.Add("onmouseout ", "this.src=images/a2.JPG ");
我试了很多个都不管用啊!那位高手帮下忙!

[解决办法]
直接onmouseover="this.src=images/a1.JPG "不行么
[解决办法]
不可以提示什么东西
[解决办法]
this.ImageButton1.Attributes["onmouseover"]="this.src='../images/1.gif';";
[解决办法]
可以在button的onmouseover事件里写
服务器端相对简单些
如果是在客户端的话,要调用js了
[解决办法]
Page_Load里边加下边的代码。。我的倒是没问题~

C# code
this.ImageButton1.Attributes["onmouseover"]="this.src='../images/C2.gif';";this.ImageButton1.Attributes["onmouseout"]="this.src='../images/C1.gif';";
[解决办法]
引用楼主 jclhy 的帖子:
ImageButton1.Attributes.Add("onmouseover", "this.src=images/a1.JPG ");
ImageButton1.Attributes.Add("onmouseout ", "this.src=images/a2.JPG ");

[解决办法]
发现我好值得BS.....

ImageButton1.Attributes.Add("onmouseover", "this.src='images/a1.JPG'");
ImageButton1.Attributes.Add("onmouseout ", "this.src='images/a2.JPG'");
[解决办法]
ImageButton本来就没有 onmouseover 这个属性!根本不执行!
-------------------------
这个是html元素的常见事件,作为服务器端控件不一定有这个属性,很正常的!
ImageButton最终会被解析成html元素的!猜测你的路径错误了
[解决办法]
结果还漏了分号....
大家BS我吧.....

读书人网 >asp.net

热点推荐