Hi, newbie here.
I am in the process of revising a website, one of the tasks is to create a pair of buttons which, when clicked, will set the href for other buttons on the page. I have a sample code, but for some reason the target href is not being changed. When I click on "Click", then on "Target" the hi.html page is opened.
Any help would be appreciated.
Thanks, Mike
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<html>
<head>
<title>change href</title>
<script type="text/javascript">
function changeHref(xyz) {
document.getElementById('myHref').href = "bye.html";
return;
}
</script>
</head>
<body>
<a href="#" onClick="changeHref(this);">Click</a>
<br><br>
<a href="hi.html" ID="myHref">Target</a>
</body>
</html>
I am in the process of revising a website, one of the tasks is to create a pair of buttons which, when clicked, will set the href for other buttons on the page. I have a sample code, but for some reason the target href is not being changed. When I click on "Click", then on "Target" the hi.html page is opened.
Any help would be appreciated.
Thanks, Mike
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<html>
<head>
<title>change href</title>
<script type="text/javascript">
function changeHref(xyz) {
document.getElementById('myHref').href = "bye.html";
return;
}
</script>
</head>
<body>
<a href="#" onClick="changeHref(this);">Click</a>
<br><br>
<a href="hi.html" ID="myHref">Target</a>
</body>
</html>