Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    JavaScript for Generating a Multiplication table

    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.



    Code:
    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).



    And it generates them like this (given below).



    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.



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

    Regards,
    Papichoolo.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Flint, Michigan, USA
    Posts
    627
    Thanks
    1
    Thanked 20 Times in 20 Posts
    Start by adding "style='float:left;'" (no outer quotes) on the table tags. Then adjust to your liking.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •