函数只能在网页页面内调用是吗?没怎么写过js比如我在一个js里面写
function a(){
return true;
}
function b(){
//这样调用不能使用
a();
return true;
}//必须要在一些事件里调用才可以,比如:
function user_form_onload(){
//这样调用才可以用
a();
return true;
}这是js本身的特性吗?
function a(){
return true;
}
function b(){
//这样调用不能使用
a();
return true;
}//必须要在一些事件里调用才可以,比如:
function user_form_onload(){
//这样调用才可以用
a();
return true;
}这是js本身的特性吗?
<script>function a(){
alert('a()')
}
function b(){
//这样调用不能使用
a();return true;
}//必须要在一些事件里调用才可以,比如:
function user_form_onload(){
//这样调用才可以用
a();
return true;
}
b();//这样才可以
</script>
alert("a");
return true;
}
function b(){
alert("b");
a();
}
我在页面调用函数b,只会弹出函数b的消息,函数a不执行。不知道是不是和我用的tomcat容器和平台有关系,现在写代码写的有点郁闷。
function a(){
alert("a");
return true;
}
function b(){
alert("b");
a();
}
b()
</script>