Home  >  Article  >  Web Front-end  >  How to use the escape function

How to use the escape function

不言
不言Original
2019-01-31 13:40:152708browse

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)

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>

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!

Statement:
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