批改状态:合格
老师批语:总结的很认真仔细,不会的可以再看看视频,上php中文网看看手册。
#title-id{color:#FFF;}
.title-class{color:#FFF;}
style=“color:#FFF”
//window可以省略 因为像来自哪里一样省略中国//结尾都用;分号结尾//console.log 将代码发到控制台 像调试一样console.log(window);//docmentconsole.log(window.docment);//urlconsole.log(window.docment.URL);//文档类型 doc typeconsole.log(window.docment.doctype);//根元素htmlocment Element(元素)console.log(window.docment.docmentElement);//头元素console.log(window.docment.head);//取头元素里面的东西 charset(编码)console.log(window.docment.charset);//tilteconsole.log(window.docment.head);//用JS修改的语句docment.title="这里是修改的内容";//主体body同上 同理console.log(window.docment.body);//修改语言docment.body.style.backgroundColor="这是是颜色代码#开通";//样式表 也称CSS(层叠样式表)console.log(window.docment.styleSheets);//[0]表示索引 第几个 从0开始console.log(window.docment.styleSheets[0].type);//js脚本 索引同理console.log(window.docment.script);console.log(window.docment.scrip[0]);//获取当前被执行脚本 快捷方式console.log(docment.surrentScript===[0]);//取元素标签 如h2 得使用元素 class id p等
//函数 function//sum就是一个变量 console相当于一个打印输出function sum(a,b){return a+b;}console.log((10,20));//另一种方法 这里不是太懂let girl ={sum=function (a,b){return a+b;}}console.log(girl.sum(30,40));//用 docment const(常量) 驼峰式命名法// get Element By Id 获取元素的IDconst docment.getElementById("title-id");//获取h2 通过id的方式// ID多个 你只会拿到第一个const h2 =docment.getElementById("title-id");console.log(h2);h2.style.background="yellow";//通过class来获取 ele是元素 class是集合 所以复数 索引 获取等同理const eles =docment.getElementsByClassName("title-class");console.log(eles[0]);
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号