博客园  :: 首页  :: 新随笔  :: 订阅 订阅  :: 管理

WebControl 的 Attributes 属性

Posted on 2006-12-17 21:41  小哈110  阅读(444)  评论(0)    收藏  举报
[C#] 

<%@ Page Language="C#" AutoEventWireup="True" %>

 
<html>
 
<head>
    
<script language="C#" runat="server">
 
        
void Page_Load(Object sender, EventArgs e) {
           TextBox1.Attributes[
"onblur"]="javascript:alert('Hello! Focus lost from text box!!');";    
        }

    
</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>
 

[JScript] 

<%@ Page Language="JScript" AutoEventWireup="True" %>

 
<html>
 
<head>
    
<script language="JSCRIPT" runat="server">
 
        
function Page_Load(sender : Object, e : EventArgs){
            TextBox1.Attributes(
"onblur"= "javascript:alert('Focus lost from text box!!');"
        }

    
</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 tab out of this text box" 
     runat
="server"/>  
 
 
</form>
 
</body>
 
</html>