Javascript examples for DOM HTML Element:Anchor
Anchor search Property - Change the querystring part of a link:
<!DOCTYPE html> <html> <body> <p><a id="myAnchor" target="_blank" href="http://www.example.com:80/test.htm?id=searchtest">Example link</a></p> <button onclick="myFunction()">change the querystring part of the link above</button> <p id="demo"></p> <script> function myFunction() {// w w w .j ava 2 s . c o m document.getElementById("myAnchor").search = "somenewsearchvalue"; document.getElementById("demo").innerHTML = "The querystring part was changed from 'searchtest' to 'somenewsearchvalue'."; } </script> </body> </html>