2011-01-20 101 views
0

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> 

我認爲所有的鼠標事件的屬性是合法的,所以我不知道它在抱怨什麼。

+0

雖然它的工作原理,您應該添加onmouseout,onmouseover,onmousedown通過圖像按鈕的屬性。 – ScottE 2011-01-20 16:10:41

回答

3

如果你複製它從你的代碼逐字你缺少一個等號:

onmousedown事件「this.src =‘圖像/ add_plus_3.gif’」

+0

謝謝,鷹眼。現在爲什麼愚蠢的翻譯不能告訴我這個? – Buggieboy 2011-01-20 16:12:11

1
<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()" />