...

View Full Version : JavaScript for Generating a Multiplication table



Papichoolo
01-15-2012, 10:26 AM
Ok, just to be honest this is for my assignment from my University, I have completed the whole code myself I just can't seem to get just one little thing.




function GenerateTables(){
var start = document.tables.start.value;
var end = document.tables.end.value;
var size = document.tables.size.value;

for (start; start <= end; start++) {
document.write("<table width='100' align='center'>")
document.write("<caption><b>Table of </b>" + start + "</caption><br>")
document.write("</table><br>")

for (var i = 1; i <= size; i++) {

document.write("<table border=1 align='center'>")
document.write("<tr height=40 align='center'>")
document.write("<td width=40 align='center'>" + start + "</td>")
document.write("<td width=40 align='center'> * </td>")
document.write("<td width=40 align='center'>" + i + "</td>")
document.write("<td width=40 align='center'> = </td>")
document.write("<td width=40 align='center'>" + start * i + "</td>")
document.write("</tr>")
document.write("</table>")
}
}
}

The function generates multiplication tables depending on the input user provides using this interface (given below).

http://imgit.me/i/9h4J0g9.jpg

And it generates them like this (given below).

http://imgit.me/i/6n5q6v6.jpg

Now what I want is to generate those tables sideways not downwards. Not all the tables, but it should complete one table downwards, then start the new table on its side.

http://imgit.me/i/r9K33m0.png

I can't seem to figure out anything that would make that happen, and ideas would be appreciated, thanks.

Regards,
Papichoolo.

Philip M
01-15-2012, 11:08 AM
Suggest you get together with parishay at http://www.codingforums.com/showthread.php?t=248891

But your question really relates to HTML not Javascript.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum