Drill down on the enumeration features in JavaScript

Source: Internet
Author: User

  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 ;                       "Two is" + Enumdepartment.two + "  &nbs P     "+                                  "ThREE is "+ Enumdepartment.three +"         "+                                  "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>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.