SoFunction
Updated on 2025-02-28

javascript output single and double quotes in complex nested environments

javascript output single and double quotes in complex nested environments

Updated: May 26, 2009 02:01:21 Author:
If a simple nest is usually double quotes outside, single quotes inside, and vice versa. If you are particularly responsible for nesting, please look at the following method.
<a href="javascript:alert('There are 2 single quotes and one double quote here :)');" >Nesting of quotes</a>

The ASCII code of single quote ‘ is 39 and double quote ‘ is 34, so we can use the form of &#xxx; instead of specific symbols. Although it has become the form of &#xxx;, you still have to be careful in the nested environment. The quotes used by alert() in the code here are single quotes, and the string in alert should be escaped from single quotes. So there is the form of \&#39;. Otherwise, you must escape from \&#34;

  • javascript
  • Nesting
  • Single quotes
  • Double quotes

Related Articles

  • Talk about my understanding of JavaScript prototypes and closure series (Note 9)

    This article mainly introduces the relevant information about my understanding of JavaScript prototype and closure series (Note 9). Friends who need it can refer to it.
    2015-12-12
  • JS implements a method to determine whether the page has been shared successfully in WeChat

    This article mainly introduces the method of JS to determine whether the page has been shared successfully in WeChat. It analyzes the relevant operation techniques of js calling the WeChat interface to judge the web sharing function. Friends who need it can refer to it
    2017-06-06
  • Some special usages of js operator

    This article mainly introduces some special usages of js operators. Friends who need it can refer to it.
    2018-07-07
  • Detailed explanation of webpack's pitching loader

    This article mainly introduces the detailed explanation of webpack's pitching loader. The example code is introduced in the article in detail, which has a certain reference learning value for everyone's study or work. Friends who need it, please learn with the editor below.
    2019-09-09
  • JS+JSP checkBox All selections for specific implementation

    This article introduces you to using JS+JSP to implement checkBox selection. There is a good example below. Interested friends can refer to it.
    2014-01-01
  • Analysis of the implementation method of drop-down list of WeChat applets (with complete source code)

    This article mainly introduces the analysis of the implementation method of the drop-down list of WeChat applets (with complete source code). The example code is introduced in this article in detail, which has certain reference value for everyone's learning or work. Friends who need it can refer to it.
    2019-08-08
  • Analysis of common JSON operation examples of JavaScript

    This article mainly introduces common JSON operations in JavaScript, briefly describes the concept of json and common json types, and analyzes the related operation techniques of json in combination with examples. Friends who need it can refer to it
    2018-08-08
  • JS realizes the simple web tab effect of automatic timing switching

    This article mainly introduces the simple web page tab effect of JS to realize automatic timing switching, involving JavaScript to realize timing switching based on time function timing trigger traversal function. Friends who need it can refer to it
    2015-10-10
  • () Usage and precautions (incompatible under ff)

    Today I dealt with the compatibility issue between ie and ff of the date selector. It was difficult to find errors in this situation. I searched for a long time before I positioned the error in JS to create elements () method. This method supports creating elements in this way under ie.
    2013-03-03
  • Several implementation methods for merging objects in js

    "js merge objects" is a common operation in JavaScript programming, which is used to merge the properties of multiple objects together. Usually, we will use ES6 extension operators or () functions to implement this function. If you are interested, you can learn about it.
    2023-08-08

Latest Comments