JavaScript string Method Pass parameter

Source: Internet
Author: User
The JavaScript string method passes through the nested single quotation marks, and the double quotes are too large. A little confusing.

The correct method is as follows:

' <td align= ' left "><input type=" button "id=" Btnback "value=" OK "class=" BIGBT "onclick=" Continuepassword (\ ' + cardnumber+ ' \ ') '/></td> '

Since the outermost is a single quotation mark, the method uses double quotation marks, and the method parameter is single quotation mark. The beginning of the backslash single quotation mark \ ' is the outermost single quotation mark. then inward. The right side of the parameter is inward, and then the character single quotation mark is externally escaped.

Example two:

Onkeyup= ' if (IsNaN (value)) ExecCommand (\ "" +undo+ "\") '

As above, it's just a single quotation mark, because the outermost is double quotation marks.

JavaScript string Method Pass parameter

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.