W3Schools được tối ưu hóa cho việc học và đào tạo. Ví dụ có thể được đơn giản hóa để cải thiện việc đọc và học tập. Hướng dẫn, tài liệu tham khảo và ví dụ được xem xét liên tục để tránh lỗi, nhưng chúng tôi không thể đảm bảo tính chính xác đầy đủ của tất cả các nội dung. Trong khi sử dụng W3Schools, bạn đồng ý đã đọc và chấp nhận các điều khoản sử dụng, cookie và chính sách bảo mật của chúng tôi.
Bản quyền 1999-2022 bởi dữ liệu refsnes. Đã đăng ký Bản quyền. W3Schools được cung cấp bởi W3.CSS.
W3Schools is Powered by W3.CSS.
Cải thiện bài viết
Lưu bài viết
Điều kiện tiên quyết: hàm Escape [] JavaScript Escape [] JavaScript escape[] Function
Dưới đây là ví dụ về hàm unescape [].unescape[] function.
- Example:
unescape[string]
0unescape[string]
1unescape[string]
2unescape[string]
4unescape[string]
5unescape[string]
6unescape[string]
0unescape[string]
9Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at
0Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at
1Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at
2unescape[string]
2Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at
4 - Output:
Geeks for Geeks!!! To contribute articles contact us at
Geeks for Geeks!!! To contribute articles contact us at
Hàm unescape [] trong javascript lấy một chuỗi làm tham số và sử dụng để giải mã chuỗi đó được mã hóa bởi hàm Escape []. Trình tự thập lục phân trong chuỗi được thay thế bằng các ký tự mà chúng đại diện khi được giải mã thông qua unescape [].unescape[] function in JavaScript takes a string as a parameter and uses to decode that string encoded by the escape[] function. The hexadecimal sequence in the string is replaced by the characters they represent when decoded via unescape[].
Syntax:
unescape[string]
Tham số: Hàm này chấp nhận một tham số duy nhất như đã đề cập ở trên và được mô tả dưới đây: This function accepts a single parameter as mentioned above and described below:
- Chuỗi: Các tham số này giữ chuỗi sẽ được giải mã. This parameters holds the string that will be decoded.
Giá trị trả về: Hàm này trả về một chuỗi được giải mã. This function returns a decoded string.
Lưu ý: Hàm này chỉ giải mã các ký tự đặc biệt, hàm này bị tước bỏ. / * _ This function only decodes the special characters, this function is depricated.
Exceptions: @ – + . / * _Thêm mã ví dụ cho hàm trên như sau: Chương trình 1:
Program 1:________số 8
Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at
7Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at
8Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at
9unescape[string]
6unescape[string]
4escape[ string ]
3escape[ string ]
4unescape[string]
4unescape[string]
5unescape[string]
6unescape[string]
4Geeks%20for%20Geeks%21%21%21 To%20contribute%20articles%20contact%20us%20atcontribute @geeksforgeeks.org
1Geeks%20for%20Geeks%21%21%21 To%20contribute%20articles%20contact%20us%20atcontribute @geeksforgeeks.org
2unescape[string]
4Geeks%20for%20Geeks%21%21%21 To%20contribute%20articles%20contact%20us%20atcontribute @geeksforgeeks.org
5unescape[string]
6Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at
8Geeks%20for%20Geeks%21%21%21 To%20contribute%20articles%20contact%20us%20atcontribute @geeksforgeeks.org
9unescape[string]
0unescape[string]
1unescape[string]
2unescape[string]
3unescape[string]
4escape[ string ]
3escape[ string ]
4unescape[string]
4unescape[string]
5unescape[string]
6unescape[string]
4Geeks%20for%20Geeks%21%21%21 To%20contribute%20articles%20contact%20us%20atcontribute @geeksforgeeks.org
1Geeks%20for%20Geeks%21%21%21 To%20contribute%20articles%20contact%20us%20atcontribute @geeksforgeeks.org
2Geeks for Geeks!!! To contribute articles contact us at
6Output:
Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at
Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at
8Geeks%20for%20Geeks%21%21%21 To%20contribute%20articles%20contact%20us%20atcontribute @geeksforgeeks.org
9unescape[string]
0- Các trình duyệt được hỗ trợ:
- Google Chrome 1 trở lên
- Cạnh 12 trở lên
- Internet Explorer 3 trở lên
- Mozilla Firefox 1 trở lên
- Safari 1 trở lên
Hàm Escape [] có thể được sử dụng để mã hóa một chuỗi để sử dụng trong hàm url. Hàm unescape [] có thể được sử dụng để giải mã một chuỗi được mã hóa. Các chức năng này có thể được sử dụng để đảm bảo rằng một chuỗi an toàn để sử dụng trong URL. Các chức năng này có thể được sử dụng để giải mã một chuỗi đã được mã hóa để sử dụng trong URL.
1. escape[] function: This function takes a string as a single parameter & encodes the string that can be transmitted over the computer network which supports
ASCII characters. Encoding is the process of converting plain text into ciphertext.
Syntax:
escape[ string ]
Tham số: Hàm này chấp nhận một tham số duy nhất: This function accepts a single parameter:
- Tôi có thể sử dụng gì thay vì Unescape? This parameter holds the string that will be encoded.
Hàm unescape [] không được chấp nhận. Sử dụng decodeUri [] hoặc decodeuricomponent [] thay thế. Returns an encoded string.
Việc sử dụng chức năng thoát trong JavaScript là gì? The escape[] function only encodes the special characters, this function is deprecated.
Ngoại lệ: @ - +. / * _ @ – + . / * _
Ví dụ 1: Trong ví dụ này, chúng tôi đã sử dụng ký tự đặc biệt để xem các thay đổi. & NBSP;In this example, we have used the special character to see the changes.
JavaScript
Geeks for Geeks!!! To contribute articles contact us at9
Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at9
unescape[string]2
unescape[string]4
unescape[string]5
unescape[string]6
Geeks for Geeks!!! To contribute articles contact us at9
Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20 at%20 Decoded : To contribute articles contact us at8
Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at0
0
1
unescape[string]2
Geeks for Geeks!!! To contribute articles contact us at6
Output:
Geeks%20for%20Geeks%21%21%21 To%20contribute%20articles%20contact%20us%20atcontribute @geeksforgeeks.org
Geeks for Geeks!!! To contribute articles contact us at
Từ ví dụ trên, chúng ta có thể thấy mã hóa được giải mã cho văn bản thuần túy bằng cách sử dụng hàm unescape [].unescape[] function that will decode the encoded text. Decoding is the process of converting ciphertext into plain text.
Ví dụ 2: & nbsp;This function takes a string as a single parameter and uses it to decode that string encoded by the escape[] function. The hexadecimal sequence in the string is replaced by the characters they represent when decoded via unescape[] function.
Syntax:
unescape[string]
Tham số: Hàm này chấp nhận một tham số duy nhất: This function accepts a single parameter:
- Chuỗi: Tham số này giữ chuỗi sẽ được giải mã. This parameter holds the string that will be decoded.
Giá trị trả về: Trả về một chuỗi được giải mã. Returns a decoded string.
Lưu ý: Hàm này chỉ giải mã các ký tự đặc biệt, chức năng này không được dùng nữa.This function only decodes the special characters, this function is deprecated.
Ngoại lệ: @ - +. / * _ @ – + . / * _
Ví dụ 1: Trong ví dụ này, chúng tôi đã sử dụng ký tự đặc biệt để xem các thay đổi. & NBSP;In this example, we have used the special character to see the changes.
JavaScript
unescape[string]0
unescape[string]1
unescape[string]2
unescape[string]4
unescape[string]5
unescape[string]6
unescape[string]0
unescape[string]9
Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at0
Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at1
8unescape[string]2
Geeks for Geeks!!! To contribute articles contact us at6
Output:
Geeks for Geeks!!! To contribute articles contact us at
Từ ví dụ trên, chúng ta có thể thấy mã hóa được giải mã cho văn bản thuần túy bằng cách sử dụng hàm unescape [].
Ví dụ 2: & nbsp;
JavaScript
Geeks for Geeks!!! To contribute articles contact us at
Từ ví dụ trên, chúng ta có thể thấy mã hóa được giải mã cho văn bản thuần túy bằng cách sử dụng hàm unescape [].
unescape[string]4
unescape[string]5
unescape[string]6
Ví dụ 2: & nbsp;
unescape[string]4
Geeks%20for%20Geeks%21%21%21 To%20contribute%20articles%20contact%20us%20atcontribute @geeksforgeeks.org5
unescape[string]6
Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at7
Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at8
Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at9
unescape[string]6
unescape[string]4
escape[ string ]3
escape[ string ]4
Từ ví dụ trên, chúng ta có thể thấy mã hóa được giải mã cho văn bản thuần túy bằng cách sử dụng hàm unescape [].
unescape[string]4
unescape[string]5
unescape[string]6
Ví dụ 2: & nbsp;
Geeks for Geeks!!! To contribute articles contact us at6
Output:
Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20 at%20 Decoded : To contribute articles contact us at
Encoded : Geeks%20for%20Geeks%21%21%21
Decoded : Geeks for Geeks!!!
Encoded : To%20contribute%20articles%20contact%20us%20at%20
Decoded : To contribute articles contact us at
7 Encoded : Geeks%20for%20Geeks%21%21%21
Decoded : Geeks for Geeks!!!
Encoded : To%20contribute%20articles%20contact%20us%20at%20
Decoded : To contribute articles contact us at
8Encoded : Geeks%20for%20Geeks%21%21%21
Decoded : Geeks for Geeks!!!
Encoded : To%20contribute%20articles%20contact%20us%20at%20
Decoded : To contribute articles contact us at
9unescape[string]
6
1. |
unescape[string]4 escape[ string ]3 escape[ string ]4 |
unescape[string]4 Geeks%20for%20Geeks%21%21%21 To%20contribute%20articles%20contact%20us%20atcontribute @geeksforgeeks.org1 Geeks%20for%20Geeks%21%21%21 To%20contribute%20articles%20contact%20us%20atcontribute @geeksforgeeks.org2 |
2. |
Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at8 Geeks%20for%20Geeks%21%21%21 To%20contribute%20articles%20contact%20us%20atcontribute @geeksforgeeks.org9 Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at0 | Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at1 unescape[string]22 |
3. | Sự khác biệt giữa hàm unescape [] & escape []: Hàm unescape [] được sử dụng để giải mã chuỗi được mã hóa bởi hàm Escape []. | Sự khác biệt giữa hàm unescape [] & escape []: Hàm unescape [] được sử dụng để giải mã chuỗi được mã hóa bởi hàm Escape []. |
4. | Hàm Escape [] trong JavaScript được sử dụng để mã hóa một chuỗi. Sử dụng hỗ trợ ký tự ASCII, nó tạo ra một chuỗi di động để nó có thể được truyền qua bất kỳ mạng nào đến bất kỳ máy tính nào. | Một chuỗi được giải mã được trả về. |
5. | Một chuỗi được mã hóa được trả về. | Hàm này chỉ mã hóa các ký tự đặc biệt, chức năng này không được dùng nữa. |