读JS高级(兼容&&BOM&&私有变量&&面向对象)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<script>
/*
兼容性问题常见解决途径
1:利用能力检测
2:利用浏览器怪癖
3:利用用户代理检测

//技巧
正则匹配的 str.text(/reg/)时 RegExp.$1 ...下就有匹配的结果
常用的匹配结尾正则用 ([^>]+)
*/

document.domain//修改可用于同域名不同二级域名的跨域.(只能修改一次,修改第二期domain不报错)
//text节点的 nomalize()规范化节点   splitText(index)分割节点
document.createComment('浏览器注释');
document.getElementsByTagName('div');//这东西是实时更新的,要注意了,很早就说过了,白学了,你个2
window.iframe[0/*number || 'name'*/];
window.top;
window.parent;
window.self;
window.moveTo(1,2);
window.moveBy(1,1);
window.location.href;
window.location.hash;
window.location.port;
window.location.path;
window.location.search;

//修改以下的东东就会修改页面的链接地址
window.location.href;
window.location.assgin;
window.location;

//搞清楚闭包和匿名函数的区别
//面向对象程序设计
//JS中的各种继承方法
</script>
</body>
</html>
原文地址:https://www.cnblogs.com/diligenceday/p/3486774.html