Skip to content

MC3D/tiy-choose-goose-homework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

#9/3/2014

Assignment

Using the HTML in index.html:

  • Create and link to a JavaScript file
  • Your program should execute the following steps:
    • Get the quantities out of the input boxes and store them in variables
    • Use Number("37") to convert the strings from the input to numbers
    • Multiply them by their cost and add them together
    • Create a string based on that number (e.g. "37 monies")
    • Change the total to use that string.
    • Put all of the above steps inside a function.
    • Assign that function to the onclick property of the update button.

Functions

To make a function fire on an event, assign it to the element's event handler:

document.getElementById("myBtn").onclick = function(){
  // Code goes here
};

Resources

Level Up