반응형

[자바스크립트] unescape() 함수의 뜻과 간단예제


unescape() 함수는 %16진수의 ASCII 아스키코드 값을 ISO LATIN-1 문자로 변환하여 되돌려주는 함수이다.

escape() 함수의 반대역할을 한다.


다음의 예를 통해 익혀보자.




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
<!DOCTYPE html>
 
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title></title>
    </head>
    <body>
        <h2>escape 함수를 이용한 예제</h2>
        <script>
            var str1, str2, str3
            str1 = "%5f"
            str2 = "%24"
            str3 = "A"
 
            document.write("<h2>"+"문자1 = "+str1)
            document.write("<h2>"+"결과 > "+unescape(str1)+"</h2><br>")
 
            document.write("<h2>"+"문자2 = "+str2)
            document.write("<h2>"+"결과 > "+unescape(str2)+"</h2><br>")
 
            document.write("<h2>"+"문자3 = "+str3)
            document.write("<h2>"+"결과 > "+unescape(str3)+"</h2><br>")
            document.write("ISO LATIN-1 문자만 가능")
        </script>
    </body>
</html>
 
cs













반응형
Posted by 제3인생자
l