哭佛林

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
ASP.NET AJAX客户端对象系统-JavaScript脚本
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    
<title>Client Type System</title>
</head>
<body>
    
<form id="form1" runat="server">
        
<asp:ScriptManager ID="ScriptManager1" runat="server">
        
</asp:ScriptManager>
    
    
<script language="javascript" type="text/javascript">
        Type.registerNamespace(
"AspNetAjaxOverView");
        
        AspNetAjaxOverView.Person 
= function(firstName, lastName)
        
{
            
this._firstName = firstName;
            
this._lastName = lastName;
        }

        AspNetAjaxOverView.Person.prototype 
= 
        
{
            get_firstName : 
function()
            
{
                
return this._firstName;
            }
,
            get_lastName : 
function()
            
{
                
return this._lastName;
            }
,
            toString : 
function()
            
{
                
return String.format("Hello, I'm {0} {1}.",
                    
this.get_firstName(),
                    
this.get_lastName());
            }

        }

        AspNetAjaxOverView.Person.registerClass(
"AspNetAjaxOverView.Person");
        
        AspNetAjaxOverView.Employee 
= function(firstName, lastName, title)
        
{
            AspNetAjaxOverView.Employee.initializeBase(
this, [firstName, lastName]);
            
            
this._title = title;
        }

        AspNetAjaxOverView.Employee.prototype 
= 
        
{
            get_title : 
function()
            
{
                
return this._title;
            }
,
            toString : 
function()
            
{
                
return AspNetAjaxOverView.Employee.callBaseMethod(this"toString"+ 
                    
" My title is '" + this.get_title() + "'.";
            }

        }

        AspNetAjaxOverView.Employee.registerClass(
"AspNetAjaxOverView.Employee", AspNetAjaxOverView.Person);
    
</script>
    
    
<input type="button" value="Bill Gates"
        onclick
="alert(new AspNetAjaxOverView.Employee('Bill', 'Gates', 'Chair man'));" />
    
<input type="button" value="Steve Ballmer"
        onclick
="alert(new AspNetAjaxOverView.Employee('Steve', 'Ballmer', 'CEO'));" />
    
</form>
</body>
</html>
posted on 2008-03-10 16:03  哭佛林<Kufolin>  阅读(117)  评论(0)    收藏  举报