<html>
<head>
<title>回调函数(callback)</title><script language="javascript" type="text/javascript"> function test(){ var score = document.getElementById("score").value; myfun(score,function(){ alert("这是回调函数,应该在最后"); }); } function myfun(num,callback){ if(num<60){ alert("不及格"); }else if(num<90){ alert("良好"); }else{ alert("优秀"); } callback(); }</script></head><body><h1>学习js回调函数</h1>成绩:<input type="text" id="score"/></br><input type="button" value="判断" onclick="test()" /><p>应该能看到调用了两个回调函数</p></body></html>原文:http://www.cnblogs.com/peterpc/p/4449709.html