<html> <body> <script language="JavaScript"> function function1() { alert(document.getElementById("myLink").protocol); } </script> <a id="myLink" href="http://www.java2java.com" target="_blank">java2s.com home page</a> <input type="Button" value="Protocol" onClick="function1();"> </body> </html>