<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<!-- 作业2:以下命名规则正确的是,错误是因为?
Var a01 = 10 错 var首字母大写了
var a_*1 = 20 错 不能用*号
var 1aa = 30 错 不能以数字开头
var a-1 = 40 错 不能用-号 -->
<ul id="wrap">
<li class="a1">天道酬勤</li>
<li>商道酬信</li>
<li class="a">学道酬苦</li>
<li>业道酬精</li>
<li>人道酬诚</li>
</ul>
<ul>
<li id="wrap1">人之初,性本善。性相近,习相远</li>
<li class="a">苟不教,性乃迁。教之道,贵以专</li>
<li>昔孟母,择邻处。子不学,断机杼</li>
<li>窦燕山,有义方。教五子,名俱扬</li>
</ul>
<script>
// 点击
var oWarp = document.getElementById("wrap");
var oA1 = oWarp.getElementsByClassName("a1")[0];
console.log(oA1);
oA1.onclick = function () {
console.log("点击")
}
// 点击
var oWarp1 = document.getElementById("wrap1");
console.log(oWarp1);
oWarp1.onclick = function () {
console.log("点击")
}
var oA1 = oWarp.getElementsByClassName("a1")[0];
console.log(oA1);
// 移入
oA1.onmouseover = function () {
console.log("移入");
}
// 移出
oA1.onmouseout = function () {
console.log("移出")
}
</script>
</body>
</html>