因为你输出document.write是在onload之前执行的,这个时候还没有执行过aa()呢,需要注意的是document.write这个方法只有当body onload之前,即输出流没有关闭的时候才有效。