时间:2021-07-01 10:21:17 帮助过:42人阅读

我们先来看一下escape函数基本语法
escape(string)
注意:escape()函数是可以对除了, / ? : @ & = + $ # 。.之外的特殊字符编码。
我们来看具体示例
代码如下
<!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>浏览器上显示效果如下

本篇文章到这里就全部结束了,更多精彩内容大家可以关注Gxl网的其他相关栏目教程!!!
以上就是escape函数怎么使用的详细内容,更多请关注Gxl网其它相关文章!