The use of prompt
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" ><html> <head> <title>Test02.html</title> <script type="Text/javascript"> /*var count=prompt ("Please enter the number of times:", ""); for (Var i=0;i<count;i++) {Document.writeln ("Hello javascript! <br/> "); }*/ //Print triangle varNum=prompt ("Please enter the number of lines in the triangle:"); for(varI=1; i<=num;i++) { for(varj=1; j<=i;j++) {Document.writeln ("* ")} Document.writeln ("<br/>"); }//Print the bottom half of the diamond for(vari=num-1;i>0; i--) { for(j=i;j>0; j--) {Document.writeln ("* ")} Document.writeln ("<br/>"); } document.rte ();//Print square, print up to 8 lines varNum2=prompt ("Please enter the number of rows in the square:","");if(num2>8) {num2=8; } for(varI=1; i<=num2;i++) { for(varj=1; j<=num2;j++) {Document.writeln ("* ")} Document.writeln ("<br/>"); }</script> </head> <body Style="Text-align:center;" > </body></html>
The use of javascript-prompt