","image":"http://www.luping.net/uploads/20241107/1730952727672c3e1793ae3.jpg","datePublished":"2024-11-08T15:37:24+08:00","dateModified":"2024-11-08T15:37:24+08:00","author":{"@type":"Person","name":"luping.net","url":"https://www.luping.net/articlelist/0_1.html"}}
Changing the href Attribute of an Anchor Tag Using JavaScript on Button Click
In web development, the need to dynamically modify the href attribute of an anchor ...jhhghj
Alternatively, you can prevent the page from scrolling using:
...jhhghj
or return false from the f1() function:
function f1() {
document.getElementById("abc").href = "xyz.php";
return false;
}
For a more unobtrusive approach, employ an external JavaScript file:
document.getElementById("myLink").onclick = function() { document.getElementById("abc").href = "xyz.php"; return false; };
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3