js 如何获取方法的返回值!!!!
function Init(){
alert(testA());
}
function testA(){
//testB(); 能不能像C#那样获取
}
function testB(){
return "hello";
}
[解决办法]
- HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><title>onresize test</title></head><body onload='Init()'><script type="text/javascript"> function Init() { alert(testA()); } function testA() { var a = testB(); return a; } function testB() { return "hello"; }</script></body></html>
[解决办法]
<script type="text/javascript">
function Init(){
alert(testA());
}
function testA(){
return testB();
}
function testB(){
return "hello";
}
Init();
</script>
[解决办法]
function Init(){
alert(testA());
}
function testA(){
return testB(); 能不能像C#那样获取
}
function testB(){
return "hello";
}
调用Init()会弹出"hello";
[解决办法]
+1这样就可以获得返回值了呀。