通过 id 获取文档元素
第一关:通过 id 获取文档元素
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>get element by id</title>
</head>
<body>
<a id="a1" src="https://www.google.com">Google</a>
<p id="p1">this is a text</p>
<script>
<!-- 请在此处编写代码 -->
<!---------Begin--------->
var myElement = document.getElementById("a1");
<!---------End--------->
myElement.href="https://www.educoder.net";
</script>
</body>
</html>
通过类名获取文档元素