js in some studies backslash \ in


Encounter some confusion in the study of regular time, their own research a little, recorded as follows:

In the js, when printing a character string by a backslash and letters, there will be three cases

  First, only print the letters, do not print a backslash

    Contain letters: acdeghijklmopqswyz

  Second, nothing Print

    Contain letters: bfnrtv

  Third, an error

    Contain letters: ux

For the second and third cases, indicating that these are in line with the special, are summarized as follows:

  \ B backspace

  \ F formfeed

  \ N newline

  \ R carriage return

  \ T horizontal tab

  \ V vertical tab

  \ U unicode code, usually followed by four hexadecimal numbers, therefore, usually unicode-16, for example, \ u4f60 that you

  \ X 16 hex meaning behind with two, then a single-byte code, for example \ xA7 represent §

 

Will use positive / Replace \ relatively easy, but in turn was replaced will be very troublesome, online information, there are two solutions

  1, to the back-end

  2, in the body plus a hidden input, the string will be converted to a starting value set

 

 

Guess you like

Origin www.cnblogs.com/anch/p/11984060.html