General functions of JavaScript

Source: Internet
Author: User

(1) Alert function: Displays a warning dialog box, including an OK button.

(2) Confirm Function: Displays a confirmation dialog box, including OK, Cancel button.

(3) Escape Function: Converts a character to a Unicode code.

(4) eval function: Evaluates the result of an expression.

[JavaScript]View Plaincopyprint?
    1. Eval ("X=10;y=20;document.write (x*y)");
    2. document.write (eval ("+ +)");
    3. var x=10;
    4. document.write (eval (x+17));

The eval function can execute strings as JavaScript code, but this approach is violent and affects the efficiency of JavaScript code, and it's best to avoid using


(5) IsNaN function: The test is (true) No (false) is not a number.

(6) parsefloat Function: Converts a string into a numeric form of a character.

(7) parseint Function: Converts a string into an integer number form (can specify a few binary).

(8) prompt function: Displays an input dialog box prompting for user input. For example:

[JavaScript]View Plaincopyprint?
    1. <scriptlanguage="JavaScript" >
    2. Alert ("input error");
    3. Prompt ("Please enter your name","name"); //(title, default)
    4. Confirm ("OK no!  ");
    5. </script>



(9) unescape function: Decodes characters encoded by the escape function.

(10) isfinite (number) to detect whether a value can be a finite digit, which returns TRUE or False

(11) IsNaN (string) to detect whether a value is not a finite number

(12) decodeURI () Decodes the encoded URI address

(13) decodeuricomponent () Decodes the encoded URI component

(14) encodeURI () to encrypt a string as a URI

(15) encodeURIComponent () encode a string as a URI component

General functions of JavaScript

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.