Results 1 to 2 of 2

Thread: Need Help with HTML/JavaScript Assigment (I'm new in HTML/JavaScript)

  1. #1
    Join Date
    Mar 2013
    San Mateo, CA

    Post Need Help with HTML/JavaScript Assigment (I'm new in HTML/JavaScript)

    I need to finish this assignment:


    -Use prompt dialog boxes for input.
    -Get the user.s name.
    -Get a 3 digit integer value from the user and convert it into an integer with the parseInt method.
    -Calculate the number of hundreds in the integer.
    -Calculate the number of tens in the integer.
    -Calculate the number of ones in the integer.
    -Output Programmed by Your Name, the user.s name, the number input and the number of hundreds, tens, and ones in the number. Use one line for each and be sure to label your output clearly.

    This is what I've come up with so far, but I can't figure out the Calculate part of the code:

    <title>Lab Assignment #4 CIS 111</title>
    <script type = "text/javascript">

    var name;
    var integer;

    name = window.prompt( "Please Enter Your Name:" );
    integer = window.prompt( "Please A Three Digit Integer:" );

    integer = parseInt( integer );

    document.writeln( "<h1>This Was Programmed by Gerson Flores. The User's Name Is, " + name +
    ", The Three Digit Integer Entered By User Is: " + integer + "</h1>" );

    <p>Click Refresh (or Reload) to run this script again.</p>

    Any Help will be much appreciated!! Thanks!!

  2. #2
    Join Date
    Nov 2010
    I guess if you are using prompt and document.writeIn you won't have covered the modulus operator yet, so instead, just think about how you would do this on pen and paper... divide the first number by 100, see how many complete 100's there are, get the remainder, divide it by ten, see how many complete tens there are, etc

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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