首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

ImageButton 鼠标经过时怎么换图片

2012-05-27 
ImageButton 鼠标经过时如何换图片ImageButton 鼠标经过时如何换图片。网上有方法在load里面加ImageButton1

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我吧.....

热点排行