|
HyperLinks in HTMLA hyperlink has two parts:
Syntax for a hyperlink is: <a href="URL pointed to"> Text/image to be displayed </a> For example: <a href="http://prismoskills.appspot.com"> PrismoSkills </a> This is displayed as: PrismoSkills The displayed content can be any HTML element. For example, the above code can be changed to display an image instead of Google. <a href="http://prismoskills.appspot.com"> <img src="PS2.PNG"> </a> This is displayed as: The above image is actually a hyperlink which can be clicked to navigate to another URL. Special URLshref="/" - points to the master domain name of current page. href="" - points to the current page's URL. href="./<relative URL>" - points to a URL relative to the current page. Example: <a href="/">Master domain</a> <a href="">Current page's URL</a> <a href="../CSS/Chapter_1_-_CSS_Introduction.jsp">Relative URL</a> gives the following links: Master domain Current page's URL Relative URL Invoking JavascriptThe URL for a link can be some javascript function also. This can be done as: <script> function jsFunc() { alert ("JS function called from hyperlink"); } </script> <a href = "javascript:jsFunc()">Example link for Javascript function</a> Example link for Javascript function |
Got a thought to share or found a
bug in the code?
We'd love to hear from you:
Name: | |
Email: | (Your email is not shared with anybody) |
Comment: |
Facebook comments: