Javascript:如何使用 escape()函数

JavaScript escape() 返回经过重新编码过的字符串。转自Vnde.cn

escape()格式

   escape(String)

escape()参数

    String 必填。String 对象或文字。

注意:

  escape()只编译符号和中文 英文则原样输出

测试代码:

<script type="text/javascript">
 document.write("测试字符串<font color=\"#FF0000\">Javascript escape函数</font> 编码后<font color=\"#FF0000\">");
 document.write(escape("Javascript escape函数"));
 document.write("</font><br>");
</script>

运行结果:
测试字符串Javascript escape函数 编码后Javascript%20escape%u51FD%u6570

posted @ 2008-07-10 15:31  杰克帝.NET  阅读(3148)  评论(0编辑  收藏  举报