当我调用JavaScript函数B时,Firefox中的JavaScript控制台表示未定义函数A,但是在Chrome浏览器中定义了函数A.当我打电话功能在主体段“A”:为什么我的JavaScript函数“a”没有定义?
<input type="button" onclick="A()" value=" ..A.. ">
火狐说没有定义的函数B。为什么?
<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>
[小提琴](http://jsfiddle.net/F8Dwk/) – 2012-04-07 16:46:20
@TomaszNurkiewicz为小提琴,Chrome和FF给我的警告,但没有给出错误 – Pheonix 2012-04-07 17:23:54
@ Pheonix:你有没有得到“嗨B”和“嗨A”警报?在FF11上,我收到“hi B”警报,但按下按钮A时出现控制台错误。 – 2012-04-07 17:25:39