Variable operations, parametric functions,

Source: Internet
Author: User

Hello,world! <br/> <div style= "background:pink;width:300px;height:400px;" > <from action= "" method= "" Id= "Form1" > <p> <label for= "Beforenum" > enter the number you want to format:</br> <input name= "Beforenum" type= "text" id= "Beforenum" ></input> </label> </p> <p> <label for= "Numlength" > Please enter the length of the number to be formatted:</br> <input name= "numlength" type= "text" id= "Numlength" ></input> </label> </p> <p> <label for= "Afternum" > Formatted digital:</br> <input name= "Afternum" type= "text" id= "Afternum" ></input> &lt ;/label> </p> <input name= "Submit" type= "button" class= "" onclick= "Formatno (DOCUMENT.GETELEMENTB Yid (' Beforenum '). Value,document.getelementbyid (' Numlength '). "value=" Convert "/> <input name=" Cancel "type= "Button" class= "value=" Cancel "/> </form> </div> <script language=" JavaScript ">//Output Variable Type            varTypea=3; vartypeb= "Name"; varTypec=NULL; Objecta=NewObject (); Document.writeln ("The type of <pre>a is" + (typeofTYPEA) + "\NB type is" + (typeofTYPEB) + "\nobject1 type is" + (typeofOBJECTA) + "</pre>"); //Conditional Operators            varA=20; varB=20; Document.writeln (A!=B)?true:false; Document.writeln ("<pre> I like to learn JavaScript!!! \ n "); //new operatorobject1=NewObject (); Array2=NewArray (); Date3=NewDate ("May 21 2015") Document.writeln (Date3.getfullyear ()+ "</pre>");//If it is month, you must add 1 because the month is 0.        //uppercase and lowercase conversions            varmystring=NewString ("xinqing wil be happy!"); varLower=mystring.tolowercase (); varUpper=mystring.touppercase (); Document.writeln ("MyString converted to uppercase letters is" +Upper); //format a number to a specified length                             //call a function when you press the Convert button, with the parameter call        functionFormatno (str1,len1) {if(len1== "" | | str1== "") {alert ("Please enter number and length"); } alert ("Length" +len1+ "; character" +str1+ ";"); varstrlen=str1.length; Alert ("Length" +len1+ "; character" +strlen+ ";");  for(i=0;i<len1-strlen;i++) {str1= "0" +str1; }            varAfternum1=document.getelementbyid ("Afternum")            //alert (str1);Afternum1.value=str1; }                                </script> </body>

Variable operations, parametric functions,

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.