摘要:
添加属性 - 标签.setAttribute(属性名,属性值) var div = document.querySelector("div"); console.log(div); div.setAttribute('name','aaa') div.setAttribute('name','bbb 阅读全文
posted @ 2021-01-10 22:01
技术活当赏
阅读(65)
评论(0)
推荐(0)
摘要:
DOM : document object model 文档对象模型 操作文档的 - html文档 DOM要操作的是html文档 1.获取标签 标签名来获取 var divs = document.getElementsByTagName('div') console.log(divs); 通过id 阅读全文
posted @ 2021-01-10 21:41
技术活当赏
阅读(195)
评论(0)
推荐(0)
摘要:
1.浏览器的尺寸 - 包含滚动条 // 高度 window.innerHeight // 宽度 window.innerWidth console.log( innerHeight,innerWidth ); 2.window的事件 window.onload = function(){ // 当前 阅读全文
posted @ 2021-01-10 20:52
技术活当赏
阅读(58)
评论(0)
推荐(0)
摘要:
定时器都是异步代码 ☆ 异步 - 同步 同步:等待,按顺序执行 var a = 10; var b = 20; console.log(a); console.log(b); 异步:两件事同时在做,互不影响,没有等待,不按顺序 注意:同步代码:正常代码都是同步代码 异步代码:定时器 js是单线程 - 阅读全文
posted @ 2021-01-10 16:16
技术活当赏
阅读(273)
评论(0)
推荐(0)
摘要:
window提供了两个方法 setInterval(函数,毫秒) - 让一个函数,每隔一段时间就调用一次 var a = 1 function fn(){ console.log(123); a++; console.log(a); box.innerText = a; } setInterval( 阅读全文
posted @ 2021-01-10 14:05
技术活当赏
阅读(173)
评论(0)
推荐(0)
摘要:
获取整个地址栏的地址 // window.location.href // console.log( location.href ); // 地址栏的url:协议、域名、端口号、路径、数据、锚点 // 跳转地址:给location.href赋值 // location.href = 'http:// 阅读全文
posted @ 2021-01-10 13:41
技术活当赏
阅读(72)
评论(0)
推荐(0)
摘要:
BOM:browser object model - 浏览器对象模型 // BOM - ECMA规定怎么操作浏览器,照BOM的标准来进行 // 操作浏览器的时候,都是通过对象来操作的 // window - 浏览器窗口 // console.log(window); // 全局中定义的变量,其实也是 阅读全文
posted @ 2021-01-10 13:39
技术活当赏
阅读(72)
评论(0)
推荐(0)

浙公网安备 33010602011771号