本文介绍了javascript中clickevent上的Imagebutton图像更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想更改click上的imagebutton图像,对于图像按钮的每次单击图像交替更改请帮助我吗?
I want to change the imagebutton image on click , for each click image of image button change alternately pls help me?
推荐答案
Hope it will help you
<script language=''javascript''>
<!--
function EvImageOverChange(name, direction)
{
switch(direction)
{
case ''in'':
name.src = "image/OverImage.gif";
break;
case ''out'':
name.src = "image/InitialImage.gif";
break;
}
}
//-->
</script>
in the code behind insert this in the Page load method:
if(!IsPostBack)
{
myImageButton.ImageUrl = "image/InitialImage.gif";
myImageButton.Attributes["OnMouseOver"] =
"javascript:EvImageOverChange(this, ''in'');";
myImageButton.Attributes["OnMouseOut"] =
"javascript:EvImageOverChange(this, ''out'');";
}
这篇关于javascript中clickevent上的Imagebutton图像更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!