<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>링크</h1>
<a href="https://naver.com" name="link1">네이버</a>
<hr>
<input type="button" value="버튼" name="btn1">
<script>
//폼이 없는 경우, txt 접근하는 방법
document.all['btn1'].onclick = m1;
function m1() {
//BOM 방식
document.links['link1'].href = 'https://google.com';
document.links['link1'].target = '_black';
document.links['link1'].title = '구글로 이동합니다.';
//DOM 방식
document.links['link1'].innerText = '구글';
}
</script>
</body>
</html>