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

How to use the escape function

不言
Release: 2019-01-31 13:40:15
Original
2753 people have browsed it

The escape() function encodes a string. It makes the string portable, so it can be transmitted over the network to any computer that supports ASCII characters. The escape() function can also encode some special characters. In this article, we will take a look at the specific use of the escape() function. .

How to use the escape function

Let’s take a look at the basic syntax of the escape function

escape(string)
Copy after login

Note: The escape() function can be used except , / ? : @ & = $ # . Special character encoding other than .

Let’s look at a specific example

The code is as follows

<!DOCTYPE html>
<html>
   <head>
      <title>JavaScript String match() Method</title>
   </head>
   
   <body> 
      <script type="text/javascript">

document.write(escape("Visit W3School!") + "<br />")
document.write(escape("?!=()#%&"))

</script>     
   </body>
</html>
Copy after login

The display effect on the browser is as follows

How to use the escape function

This article ends here. For more exciting content, you can pay attention to other related column tutorials on the PHP Chinese website! ! !

The above is the detailed content of How to use the escape function. 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