How to Change a Hyperlink With JavaScript
JavaScript is an object-oriented programming language, normally used to enhance usability and make websites more dynamic. One of the most dynamic aspects of JavaScript is its ability to process links so users can navigate from one web page to another, or even from one portion of a web page to another portion within the same page. To change a hyperlink, you only need to have access to the web page code in a web-editing software program or copy and paste the code into a program like Notepad.
Instructions
-
-
1
Open the web page that contains the hyperlink you want to change in your web editing software or in Notepad or Wordpad.
-
2
Locate the hyperlink. All JavaScript hyperlinks are sandwiched between hyperlink reference tags that look like this: <a href="Myhyperlink.com">My Hyperlink</href>.
-
-
3
Change the location of the link by inserting a new web address into the code. For example, to change Myhyperlink.com to Yahoo.com, you would insert Yahoo.com inside the "a href" tag.
<a href="yahoo.com">
-
4
Insert any new text associated with the new link in between the hyperlink reference tags, like this: <a href="yahoo.com">Go to Yahoo</href>.
-
5
Save your web page. You can then upload it to the web via a file transfer program.
-
1
References
- Photo Credit Internet hyperlink image by Star from Fotolia.com