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 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Maths tables in Javascript..Help Urgently

    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:
    Attached Files Attached Files

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    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
    Last edited by Philip M; 01-15-2012 at 09:04 AM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It shows result as 1*2=2 they come altogether i need them in different boxes


    <body>
    <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>

  • #4
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,981
    Thanks
    56
    Thanked 557 Times in 554 Posts

    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?

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,919
    Thanks
    79
    Thanked 4,423 Times in 4,388 Posts
    This is impossible to do as assigned!
    Code:
    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.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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