的ImageButton随着鼠标事件处理考虑不规范
问题描述:
ASP.NET说,下面的ImageButton服务器标记的格式不正确:的ImageButton随着鼠标事件处理考虑不规范
<asp:TableCell VerticalAlign="Top">
<asp:ImageButton runat="server" ID="imgAdd" src="Images/add_plus_1.gif"
onmouseout="this.src='Images/add_plus_1.gif'"
onmouseover="this.src='Images/add_plus_2.gif'"
onmousedown"this.src='Images/add_plus_3.gif'"
CauseValidation="false" style="cursor: pointer"
OnClientClick="Javascript:SL_AddBuilding()" />
</asp:TableCell>
我认为所有的鼠标事件的属性是合法的,所以我不知道它在抱怨什么。
答
如果你复制它从你的代码逐字你缺少一个等号:
onmousedown事件“this.src =‘图像/ add_plus_3.gif’”
+0
谢谢,鹰眼。现在为什么愚蠢的翻译不能告诉我这个? – Buggieboy 2011-01-20 16:12:11
答
<asp:ImageButton runat="server" ID="imgAdd" src="Images/add_plus_1.gif"
onmouseout="this.src='Images/add_plus_1.gif'"
onmouseover="this.src='Images/add_plus_2.gif'"
onmousedown="this.src='Images/add_plus_3.gif'"
CauseValidation="false" style="cursor: pointer"
OnClientClick="Javascript:SL_AddBuilding()" />
虽然它的工作原理,您应该添加onmouseout,onmouseover,onmousedown通过图像按钮的属性。 – ScottE 2011-01-20 16:10:41