12 JavaScript globle对象

1 URI

URI通用资源标识符

var uri = 'http://www.apeland.cn/web index.html?name=zhansan';
console.log(encodeURI(uri)); //解析出空格为 %20 表示
console.log(encodeURIComponent(uri)); //完全解析

var encodeuri = 'http%3A%2F%2Fwww.apeland.cn%2Fweb%20index.html%3Fname%3Dzhansan';
console.log(encodeURI(encodeuri)); //简单解析
console.log(decodeURIComponent(encodeuri)); //完全解码

2 window对象

//在js当中,一个顶头的对象是window对象
var a = 3;
console.log(window.a)

function hello() {
    alert(window.a);
}
window.hello();
posted @ 2022-08-05 15:47  角角边  Views(47)  Comments(0)    收藏  举报