按钮 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>