(1)eval(string)
该函数的功能是计算字符串表达式的值,并执行其中的javascript代码。
document.write(eval("3+6"));
document.write("<br>");
eval("x=5;y=6;document.write(x*y)");
------------------------------------------运行结果
9
30
-------------------------------------------
(2)encodeURI(url)
该函数主要用于将URI字符串进行编码
如下:
var URI="http://127.0.0.1/save.html?name=测试";
document.write(encodeURI(URI));
------------------------------------------运行结果
http://127.0.0.1/save.html?name=%E6%B5%8B%E6%E8%AF%95
------------------------------------------------
(3)decodeURI(url)
该函主要用于对已编码的URI字符串进行解码;
用法和encodeURI(url)函数一样,作用相反