Javascript ⾏内事件编写
按钮 button; 点击 onclick; ⽂档 document; 内 inner <!DOCTYPE html ><html lang ="zh-CN"><head > <meta charset ="UTF-8"> <meta name ="viewport" content ="width=device-width,initial-scale=1"> <title >⾏内事件编写 onclick =""</title > <meta name ="Keywords" content ="关键字"> <meta name ="description" content ="简介"> <style > body { transition : all .5s ; } </style ></head ><body ><!-- 按钮 button ; 点击 onclick ;⽂档 document ;内 inner --><button onclick ="document.body.style.backgroundColor=this.innerText">aqua </button ><button onclick ="document.body.style.backgroundColor=this.innerText">pink </button ><button onclick ="document.body.style.backgroundColor=this.innerText">green </button ><script > console .log ('hello,word') let d = new Date () let info = `${d .getFullYear ()}年${d .getMonth () + 1}⽉${d .getDate ()}⽇` console .log (info ) /*红⾊输出 error*/ console .error ('凯迪拉克') /*警告输出 warn*/ console .warn ('雪中') /*打开就是lightgreen 这个⾊*/ document .body .style .backgroundColor = 'lightgreen'</script ></body ></html >1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
26
27
28
29
30
31
32
33
发布评论