views:

7

answers:

0

In this code have button and anchor with click event. alert(document.getElementById("btn").click); //not working in safari alert(document.getElementById("btn1").click); // is working in safari

I want to execute anchor's click event What I do? -----------------------Code-----------------------------

< script type="text/javascript"> function clickMe() { alert('My Name is ' + event.srcElement.name); } < /script> < /head>

< body> < a href="#" name="btn" id="btn" onclick="clickMe()">a< /a> < input type="button" href="#" name="btn1" id="btn1" onclick="clickMe()"/> < script> //document.getElementById("btn").click(); alert(document.getElementById("btn").click); alert(document.getElementById("btn1").click); < /script>