这不能使用javascript完成,但可以使用jQuery完成。也许这个网址可以帮助你。 http://labs.abeautifulsite.net/projects/js/jquery/alerts/demo/