JS-全局对象-URI-Window

URI 解码

    var uri = "http://www.codelinux.cn/js-date%e5%af%b9%e8%b1%a1.html";
    // http://www.codelinux.cn/js-date对象.html
    console.log(decodeURI(uri));
    // http://www.codelinux.cn/js-date对象.html
    console.log(decodeURIComponent(uri));

URI 编码

    var uri = "http://www.codelinux.cn/js-date对象.html";
    // http://www.codelinux.cn/js-date%E5%AF%B9%E8%B1%A1.html
    console.log(encodeURI(uri));
    // http%3A%2F%2Fwww.codelinux.cn%2Fjs-date%E5%AF%B9%E8%B1%A1.html
    console.log(encodeURIComponent(uri));

Window 对象

    var color = "red";
    function sayColor(){
        alert(window.color);
    }
    window.sayColor();  //"red"