asp.net imagebutton控件,我想鼠标移上去改变图片,下面是我的代码,剩下的应该怎么写
<tdwidth="125"background="images/d3.gif"onmouseout="as_bg(this,'out')"onmouseover="as...
<td width="125" background="images/d3.gif"onmouseout="as_bg(this,'out')"
onmouseover="as_bg(this,'over')">
<asp:ImageButton ID="ImageButton6" runat="server" ImageUrl="~/images/dl1.gif"
onclick="ImageButton6_Click" />
</td>
<script>
function as_bg(t,fla)
{
if(fla=="over")
{
}
else
{
}
}
</script> 展开
onmouseover="as_bg(this,'over')">
<asp:ImageButton ID="ImageButton6" runat="server" ImageUrl="~/images/dl1.gif"
onclick="ImageButton6_Click" />
</td>
<script>
function as_bg(t,fla)
{
if(fla=="over")
{
}
else
{
}
}
</script> 展开
2个回答
展开全部
onmouseout="as_bg(this,'out')"
onmouseover="as_bg(this,'over')"这是改变td的背景的吧,你是想改变imagebutton的应该写
<asp:ImageButton ID="ImageButton6" runat="server" ImageUrl="~/images/dl1.gif"
onclick="ImageButton6_Click" onmouseout="as_bg(this,'out')"
onmouseover="as_bg(this,'over')" />
js里是这样的:document.all("ImageButton6").src=路径;
我简单写了个,实验通过:
<body>
<form id="form1" runat="server">
<div>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/3.gif" onmouseout="as_bg()" onmouseover="as_bg1()" />
</div>
</form>
</body>
</html>
<script>
function as_bg()
{
document.getElementById('ImageButton1').src='../../images/3.gif';
}
function as_bg1()
{
document.getElementById('ImageButton1').src='../../images/back_15.jpg';
}
</script>
onmouseover="as_bg(this,'over')"这是改变td的背景的吧,你是想改变imagebutton的应该写
<asp:ImageButton ID="ImageButton6" runat="server" ImageUrl="~/images/dl1.gif"
onclick="ImageButton6_Click" onmouseout="as_bg(this,'out')"
onmouseover="as_bg(this,'over')" />
js里是这样的:document.all("ImageButton6").src=路径;
我简单写了个,实验通过:
<body>
<form id="form1" runat="server">
<div>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/3.gif" onmouseout="as_bg()" onmouseover="as_bg1()" />
</div>
</form>
</body>
</html>
<script>
function as_bg()
{
document.getElementById('ImageButton1').src='../../images/3.gif';
}
function as_bg1()
{
document.getElementById('ImageButton1').src='../../images/back_15.jpg';
}
</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询