Javascript examples for Language Basics:console
Get Id of link and output with console.log
<html> <head> <style> </style> </head> <body> <a id="1" onclick="reply_click(this.id)" href="#">Link 1</a> <a id="2" onclick="reply_click(this.id)" href="#">Link 2</a> <a id="3" onclick="reply_click(this.id)" href="#">Link 3</a> <script> function reply_click(clicked_id) { console.log("You have clicked Link " + clicked_id); }//from w w w .j av a2 s . co m </script> </body> </html>