JavaScript Special Characters
참조 : http://www.w3schools.com/js/js_special_characters.asp
자바스크립트의 문자열에서 따옴표(")나 엠퍼세드(&)를 입력하기 위해서는 \를 사용해야 합니다.
| Code | Outputs |
|---|---|
| \' | single quote |
| \" | double quote |
| \& | ampersand |
| \\ | backslash |
| \n | new line |
| \r | carriage return |
| \t | tab |
| \b | backspace |
| \f | form feed |
예)
var txt="We are the so-called "Vikings" from the north." (X)
var txt="We are the so-called \"Vikings\" from the north." (O)
document.write ("You \& me are singing!")
var txt="We are the so-called "Vikings" from the north." (X)
var txt="We are the so-called \"Vikings\" from the north." (O)
document.write ("You \& me are singing!")