一个显示提示信息的对象WebControl.Attributes

博客介绍了获取与控件属性不对应的任意特性(只用于呈现)的集合。给出了btnDelete添加onclick特性的示例,还展示了在VB语言环境下,为TextBox控件添加onblur特性触发JavaScript弹窗的代码示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

获取与控件的属性不对应的任意特性(只用于呈现)的集合。
例:
btnDelete.Attributes.Add("onclick", "return confirm('Warning: This will delete ALL records, including all content pages and users, associated with this community.')")

获取与控件的属性不对应的任意特性(只用于呈现)的集合。
<%@ Page Language="VB" AutoEventWireup="True" %>

 <html>
 <head>
    <script language="VB" runat="server">
 
        Sub Page_Load(sender As Object, e As EventArgs)
            TextBox1.Attributes("onblur") = "javascript:alert('Hello! Focus lost from text box!!');"
        End Sub
    </script>
 
 </head>
 <body>
    <h3>Attributes Property of a Web Control</h3>
 <form runat="server">
 
    <asp:TextBox id="TextBox1" columns=54
     Text="Click here and then tap out of this text box"
     runat="server"/> 
 
 </form>
 </body>
 </html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值