IP356F13A JavaScript – Session Two Assignment

Reminder – you can use WebMatrix to work on your files. See Videos for WebMatrix Setup for more information.

Create a page your_name04.htm so that it accepts user input for one or two parameters in a function that you create. What the function does is completely up to you. But the outcome should be visible in the page (probably with window.alert())


You may use any of these Session 2 Models for ideas. But we are going to work on iteration together next week so you can skip those examples.

Save the page as your firstName_yourlastName04.htm and use FTP or WebMatrix to publish it to the UBC site.

Add a reference to this page in your 00.html table of contents too.


Create a new web page with a function that you have created.

If you can’t think of a reason to build web page with a function, try figuring out a dog’s age in dog years.


Dog Years Algorithm

If you can’t think of a function you can try this something based on this:
Formula for dogs less than 20lbs is y=4.1464x + 14.429
Dogs 20-50lbs is y= 4.6107x + 14.111
Dogs 50-90lbs is y= 5.457x + 11.61
And, finally… Dogs 90 lbs plus is: y = 7.325x + 5.2667


Reading: JavaScript Events / Closures / Anonymous Functions

Please relax and read for light understanding


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s