Re: [.NET] attribute 的 onclick

看板Visual_Basic作者 (矇面加菲獅)時間19年前 (2006/12/15 12:45), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
<script language="javascript"> function show() { <%=pic.ClientID%>.style.display = 'block'; <%=txt.ClientID%>.value = ''; } </script> ※ 引述《DANGJI (團rz)》之銘言: : 我想做的是,當textbox偵測到滑鼠的click時 : 呼叫副程式執行:1.清空textbox內的文字 : 2.顯示後面的圖片(讓圖片的visible="true") : (我看的書裡面,範例只有呼叫javascript彈出對話) : 我是用attribute的方法 : asp.net網頁開起來沒問題,但是在click那一個textbox的時候, : ie會顯示錯誤: : 行:10 : 字元:1 : 錯誤:必需要有物件 : 可以請大大們幫忙看一下是那裡出問題了嗎? : (有試過用 if txt.Attributes="true" then .... 不過似乎是沒辦法偵測到是不是有 : click) : <%@ page language="vb" %> : <script runat="server"> : sub Page_Load(obj as Object, e as EventArgs) : pic.visible="false" '載入時不顯示圖片 : txt.Attributes.add("onclick","show()") : end sub : sub show() : pic.visible="true" '顯示圖片 : txt.text="" : end sub : </script> : <html> : <body> : <form runat="server"> : <asp:image id="pic" imageurl="ok.gif" runat="server" /> : <asp:TextBox id="txt" columns=10 onclick="show()" Text="清除這裡" : runat="server"/> : </form> : </body> : </html> -- ▃▅▇▆▄ ▆▂▃ ` 逝去感如何能留住,半點遺留殊不易,██▅▇▄▃ ▇▃▂" . █████████▃i ▁▄▇ 更多悽悽慘慘的遭遇………██▆▃ █▅▆▃ˍ▄* ▂█▄▇▅▂. 我不知道,王~八~蛋~~! ▂▆███ █▄▃ 。fumizuki。Check。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 60.248.175.60
文章代碼(AID): #15WYXvJa (Visual_Basic)
討論串 (同標題文章)
文章代碼(AID): #15WYXvJa (Visual_Basic)