Why is my JavaScript function "a" not defined?

Posted by 4l3x on Stack Overflow See other posts from Stack Overflow or by 4l3x
Published on 2012-04-07T16:33:32Z Indexed on 2012/04/07 17:29 UTC
Read the original article Hit count: 217

Filed under:
|

When I call my JavaScript function B, the javascript console in firefox said that function A is not defined, but on chrome browser if defined. And when I call function "A" in body segment:

<input type="button" onclick="A()" value=" ..A.. ">

, firefox said that function B is not defined? :S

<html>
<head>
<script language="javascript" type="text/javascript">
 function B(){
   alert(" hi B ");     
   document.write('<br><br><input type="button" onClick="A()" value=" ..A..">'); 
 };

 function A(){
   alert(" hi A");
   document.write('<br><br><input type="button" onclick="B()" value=" ..b..">');
   if (window.WebCL == undefined) {
     alert("Unfortunately your system does not support WebCL. ");
     return false;
   }
 }  

    </script>
    </head>

<body>
   <input type="button" onclick="B()" value=" ..B.. ">
</body>

</html>

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about web-development