In JavaScript, the escape() method is used to encode a string so that the string can be read on all computers; syntax "escape(string)".
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
The escape() function encodes a string so that it can be read on all computers.
This method does not encode ASCII letters and numbers, nor does it encode the following ASCII punctuation characters: * @ - _ . / . All other characters will be replaced by escape sequences.
Syntax: escape(string)
Note: The escape() function cannot be used to encode URIs (UniformResourceIdentifier, referred to as "URI")). You can use the function encodeURI() instead.
Example:
<script> document.write(escape("欢迎来到PHP中文网!")); </script>
Output result:
javascript advanced tutorial]
The above is the detailed content of How to use javascript escape method. For more information, please follow other related articles on the PHP Chinese website!