日期:2014-05-17  浏览次数:20448 次

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