kensy11
asked on
multiplication table dont work
hello,
im tryning to make multiplication table it shuld ask for a table and give the answer like
2x1=2
2x2=4
2x3=6
....
Thanks
im tryning to make multiplication table it shuld ask for a table and give the answer like
2x1=2
2x2=4
2x3=6
....
Thanks
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>oefening 5’</title>
</head>
<body>
<script type="text/javascript">
document.write(" Multiplication tables")
function alertUser()
{
getal = prompt("Which multiplication table you want to see?");
}
for(teller=0;teller<11;teller++)
{
floatsom = getal*teller;
}
</script
<form>
<input type="Button" name="oneButton" value="Start" onClick="alertUser()">
</form>
</body>
</html>
ASKER
Thank you , thats just what i need.
i have changed the code a bit instead of using alert i use document.write , But i have a problem now the answer is showing like this 4x0=0 4x1=4 4x2=8 4x3=12 4x4=16 4x5=20 4x6=24 4x7=28 4x8=32 4x9=36 4x10=40
i want it to be like this
4x0=0
4x1=4
4x2=8
4x3=12
4x4=16
4x5=20
....
I have tried using the <br /> but it dont work i dont know how to do it ? can you please help
Thanks
i have changed the code a bit instead of using alert i use document.write , But i have a problem now the answer is showing like this 4x0=0 4x1=4 4x2=8 4x3=12 4x4=16 4x5=20 4x6=24 4x7=28 4x8=32 4x9=36 4x10=40
i want it to be like this
4x0=0
4x1=4
4x2=8
4x3=12
4x4=16
4x5=20
....
I have tried using the <br /> but it dont work i dont know how to do it ? can you please help
Thanks
Post your new code, I'll be at my computer in about two hours I'll look at that
ASKER
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>oefening 5’</title>
</head>
<body>
<script type="text/javascript">
document.write(" Multiplication tables")
function alertUser()
{
getal = prompt("Which multiplication table you want to see?");
showOut(getal);
}
function showOut(getal) {
var s = "";
for(teller=0;teller<11;tel ler++)
{
floatsom = getal*teller;
s += getal + "x" + teller + "=" + floatsom + "\n";
}
document.write(s);
}
</script
<form>
<input type="Button" name="oneButton" value="Start" onClick="alertUser()">
</form>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>oefening 5’</title>
</head>
<body>
<script type="text/javascript">
document.write(" Multiplication tables")
function alertUser()
{
getal = prompt("Which multiplication table you want to see?");
showOut(getal);
}
function showOut(getal) {
var s = "";
for(teller=0;teller<11;tel
{
floatsom = getal*teller;
s += getal + "x" + teller + "=" + floatsom + "\n";
}
document.write(s);
}
</script
<form>
<input type="Button" name="oneButton" value="Start" onClick="alertUser()">
</form>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try this (you enter one multiplier - say 2 - and it will
print 2x0, 2x1, etc) - that's how I understood it
Open in new window