Javascript examples for DOM Event:event function
Pass current element to event handler
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> function OpenMyPage(hyperlink) {/*from w w w . ja v a 2 s . c o m*/ var source = hyperlink.attributes.href.value; var pattern = new RegExp("(\\d+)$"); source.match(pattern); console.log(RegExp.$1); } </script> </head> <body> <a href="http://www.mydomain.com/ID=25645" onclick="OpenMyPage(this); return false;">Click HyperLink</a> </body> </html>