读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
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
分类:
JS书籍
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步