Created
March 28, 2018 15:59
-
-
Save Mortimer333/e9e9249b67d12940dd9d9c460dd77def to your computer and use it in GitHub Desktop.
Multiplication table in JavaScript (html)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title> | |
JS page | |
</title> | |
<meta http-equiv= "Content-Type" content= "text/html; charset=utf-8"> | |
<meta http-equiv= "Content-Language" content="pl"> | |
<script> | |
function table(a) | |
{ | |
document.write("<table border>") | |
document.write("<tr>"+"<td>"+"*"+"</td>") | |
for(i=1;i<=a;i++) | |
{ | |
document.write("<td>"+i+"</td>") | |
} | |
document.write("</tr>") | |
for (k=1;k<=a;k++) | |
{ | |
document.write("<tr><td>"+k+"</td>") | |
for (i=1;i<=a;i++) | |
{ | |
document.write("<td>"+i*k+"</td>") | |
} | |
document.write("</tr>") | |
} | |
document.write("</table>") | |
} | |
</script> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
var a=prompt("How big?","") | |
eval(a); | |
table(a); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment