click() (javascript) method is not working in FF

Posted by Bragaadeesh on Stack Overflow See other posts from Stack Overflow or by Bragaadeesh
Published on 2010-03-18T15:29:28Z Indexed on 2010/03/18 15:31 UTC
Read the original article Hit count: 273

Hi,

The following code is throwing two alerts as expected in IE but not in Firefox. Please help.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!--
    function myFunction(){
        alert('myfunc');
        document.getElementById('mylabel').click();
    }
//-->
</SCRIPT>

 </HEAD>

 <BODY>
  <p id='mylabel' onclick="alert('you reached');"></p>


  <input type='button' value="Click me" onclick='myFunction();'/>
 </BODY>
</HTML>

Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about javascript-events