View Full Version : Maths tables in Javascript..Help Urgently

01-15-2012, 08:54 AM
Please help me in making tables....I need it for my assignment. I have made some codes but unable to get proper result...

Objective: To understand JavaScript and Event handing in HTML page designing.

Requirement: You are required to design a HTML web page which can generate and display simple Mathematical table(s) with the help of JavaScript, by getting input from users. (Marks 35)

1. Create a function ValidateStartField to validate the start input field. Use onChange event in this function.
2. Create a function ValidateEndField to validate the end input field. Use onChange event in this function.
3. Create a function ValidateSizeField to validate the depth/size field. Use onChange event in this function.
4. Create a function GenerateTables and write the code to generate math tables.
5. Create a function DisplyTable and write the code to display a math table on HTML page.
6. To create HTML elements with the help of JavaScript pass HTML code to document.write( ) function as string. For example if you want to create HTML table with the help of JavaScript write
document.write( <table border="1"><tr><td>1</td><td>2</td></tr><tr><td>3</td><td>4</td></tr></table> );
7. For more details see screen shots file attached here:

Philip M
01-15-2012, 10:02 AM
Sorry, we will not do your homework for you. See forum Rule # 1.5.

You say you have written some code - post it (not a screenshot) here and doubtless someone will help you correct/improve it. Or ask specific questions. But you must make a substantial effort yourself.

It is your responsibility to die() if necessary….. - PHP Manual

01-15-2012, 05:21 PM
It shows result as 1*2=2 they come altogether i need them in different boxes

<form action="table" method="get" onsubmit="return CreateMultTable()">
Start Number: <input type="text" name="start" size="10" id='start' value='0'> <br>
End Number: <input type="text" name="end" size="10" id='end' value='20'> <br>
Limit: <input type="text" name="limit" size="10" id='wide' value='10'> <br>
<input type="submit" name="mult" value="Create this table"> <p>&nbsp;
<div id="tblDisplay"></div>

01-15-2012, 09:04 PM
being that we're on the javascript forum and the object of your assignment is to help you understand javascript... how about posting some of the javascript you have written?

Old Pedant
01-16-2012, 03:43 AM
This is impossible to do as assigned!

6. To create HTML elements with the help of JavaScript pass HTML code to document.write( ) function as string.

If you use document.write() in response to <form> input elements, the first use of document.write() will *WIPE OUT* your *ENTIRE* page! Including even the javascript code that you had called to do the document.write!

You *could* create a popup window or even an <iframe> and document.write into a separate window, but you can't do it to the same window.

If your instructor didn't tell you that, then your instructor is either an idiot or wants you to fail, at least the first time.