标签:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>输出Hello World</title> <script type="text/javascript"> if( confirm("是否开始运行程序?") ){ var j=prompt("请输入连续输出‘hello world!‘的次数:",1); if( j < 0 )alert("请输入大于0的整数"); for(var i=0;i<j;i++){ if( i==0 )document.write("<h3>开始输出</h3>"); document.write("<h3>Hello World</h3>"); if( i==j-1 )document.write("<h3>结束输出,共输出了"+j+"次.</h3>"); } }else{ alert("你已经放弃了执行程序"); } </script> </head> <body> </body> </html>
标签:
原文地址:http://www.cnblogs.com/xiaotaoxu/p/5544555.html