This article is mainly about the function of the enumeration in JavaScript in detail, the need for friends can come to the reference, I hope to help you.
Since the Microsoft AJAX Library has greatly expanded JavaScript, the common functionality of enumerations has been added, this time to explore the enumeration capabilities of JavaScript. Because the example is very simple, so directly look at the HTML tag is OK code as follows: <html xmlns= "http://www.w3.org/1999/xhtml" > < Head runat= "Server" > <title></title> </head> <body> <form id= "Form1" runat= "Server" > <asp:scriptmanager id= "ScriptManager1" runat= "Server" > </asp:ScriptManager> <script language= " JavaScript "type=" Text/javascript "> type.registernamespace (" Baobeime "); //Register an enumeration baobeime.enumdepartment = function () { } BaoBeiMe.EnumDepartment.prototype = { One: "Information department", &NBSp Two: "Business department", Three: "Finance Department", Four: "Research and Development department" } Baobeime.enumdepart Ment.registerenum ("Baobeime.enumdepartment"); function Button1_onclick () { var enumdepartment = new Baobeime.enumdepartment (); & nbsp var lblmsg = $get (' <%=lblmsg.clientid%> '); LBL Msg.innertext = "one is" + Enumdepartment.one + "&NBSP; " + &NBSP ; "Two is" + Enumdepartment.two + "&NBSP; &nbs P "+ "ThREE is "+ Enumdepartment.three +" &NBSP; "+ "Four is" + Enumdepartment.four + " "; } </script> <DIV>&NBS P <input id= "Button1" type= "button" value= "get so enumerated value" onclick= "return Button1_onclick ()"/><br/> <BR/ > <asp:label id= "lblmsg" runat= "Server" text= "" ></asp:Label> & nbsp </div> </form> </body> </html>