I hope you can provide more support.
I,AddScriptmanagerControl.
II,Register a namespace:
Type. registernamespace ("Demo ");
III,Add constructors, attributes, and methods to the class.
Demo. Sample = function (){}
IV,Registration type.
Demo. Person. registerclass ('demo. sample', null, SYS. idisposable)
The following is an example:
Namespace. js
Type. registernamespace ("Demo ")
Demo. Person = function (firstname, lastname, emailaddress ){
This. _ firstname = firstname;
This. _ lastname = lastname;
This. _ emailaddress = emailaddress;
}
Demo. Person. Prototype = {
Getfirstname: function (){
Return this. _ firstname;
}
Getlastname: function (){
Return this. _ lastname;
},
Getname: function (){
Return this. _ firstname + ''+ this. _ lastname;
},
Dispose: function (){
Alert ('bye' + this. getname ());
}
}
Demo. Person. registerclass ('demo. person', null, SYS. idisposable );
Namespace. aspxCode:
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en"
Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Title> namespace </title>
</Head>
<Body>
<Form runat = "server">
<Asp: scriptmanager runat = "server"/>
</Form>
<Div>
<P> This example creates an instance of the person class
And puts it in the "Demo" namespace. </P>
<Input value = "create demo. Person"
Type = "button" onbutton1click () "/>
</Div>
<SCRIPT type = "text/JavaScript"> </SCRIPT>
<SCRIPT type = "text/JavaScript" Language = "JavaScript">
Function onbutton1click ()
{
VaR testperson = new demo. Person (
'John', 'Smith ', 'John. smith@example.com ');
Alert (testperson. getfirstname () + "" +
Testperson. getlastname ());
Return false;
}
</SCRIPT>
</Body>
</Html>
Save and check the running effect.