What is correct syntax for the following scenario: show five alerts,one by one(text different), when page loads in browser -on body onload: alert(text 1)alert(text 2)alert(text 3)alert(text 4)alert(text 5), then code var iCounter=0;while(true)window.open(''http://www.google.com'')}};"... how it need be in html page? 推荐答案 嗯......你为什么要打开十亿个窗口来 www.google.com ? Umm ... why would you want to open a billion of windows to www.google.com ? 所以我要求正确的语法 - 那里应该是2个谷歌窗口,而不是bbb亿美元。 so I asked for correct syntax - there should be 2 google window, not abillion, however. < html> < head> < title> Demo< / title> < meta http-equiv =" Content-Type" content =" text / html; charset = iso-8859-1"> < script type =" text / javascript"> function init(){ alert(''Count 3''); alert(''Count 2''); alert(''Count 1''); alert(''Bye-bye!''); window.location.href =''http://www.google.com''; } window.onload = init; < / script> < / head> < body> < p>演示< / p> < / body> < / html> <html><head><title>Demo</title><meta http-equiv="Content-Type"content="text/html; charset=iso-8859-1"><script type="text/javascript">function init() {alert(''Count 3'');alert(''Count 2'');alert(''Count 1'');alert(''Bye-bye!'');window.location.href = ''http://www.google.com'';}window.onload = init;</script></head><body><p>Demo</p></body></html> 这篇关于正确的javascript语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-29 11:00