Home > Web Front-end > JS Tutorial > body text

How to use javascript escape method

青灯夜游
Release: 2021-11-10 09:33:39
Original
3885 people have browsed it

In JavaScript, the escape() method is used to encode a string so that the string can be read on all computers; syntax "escape(string)".

How to use javascript escape method

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>
Copy after login

Output result:

How to use javascript escape method

##[Recommended learning:

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!