Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-01-2012, 12:14 AM   PM User | #1
Vonice
New to the CF scene

 
Join Date: Dec 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Vonice is an unknown quantity at this point
Help with a JS assignment

Hey all, I'm really new to JavaScript, and I was assigned a project I'm having a lot of trouble with. Can anyone help me out?

Here's the instructions:
Open a text editor like Notepad (Windows) or TextEdit (Mac). Create a simple web page that contains each of the following items:

-All of the tags necessary to create a basic web page
-Your name in the TITLE and BODY of the page
-two LISTs (one ordered, one non-ordered) of:
1. an assignment summary and
2. your challenges in completing the assignment
-JavaScript that performs an age calculation. The script should
-Prompt the user for a date of birth (at least year and month)
-Display the month and year entered by the user
-Display the current date (use the Date() object)
-Calculates and displays the (approximate?) age difference in Years, months
-Prints out "Happy Birthday" and counts each line for each year of age (use a loop!)

here's a link to an example picture: http://csdev.clackamas.edu/rcarino/c...avascript2.png

Any help would be appreciated. Thanks!
Vonice is offline   Reply With Quote
Old 12-01-2012, 12:48 AM   PM User | #2
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,703
Thanks: 5
Thanked 875 Times in 850 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
Let me cordially point you to rule # 1.5 of the forum rules.

That said, what have you tried so far?
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 12-01-2012, 12:54 AM   PM User | #3
Vonice
New to the CF scene

 
Join Date: Dec 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Vonice is an unknown quantity at this point
Hey, I'm sorry.
I guess I'm stuck on how to create the lists.
am I supposed to use arrays? I'm just not sure.
and how is one supposed to be ordered, and the other not?
that's the part that is confusing me.
Vonice is offline   Reply With Quote
Old 12-01-2012, 06:16 AM   PM User | #4
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,532
Thanks: 0
Thanked 503 Times in 494 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Quote:
Originally Posted by Vonice View Post
-All of the tags necessary to create a basic web page
-Your name in the TITLE and BODY of the page
-two LISTs (one ordered, one non-ordered) of:
1. an assignment summary and
2. your challenges in completing the assignment
Those are all just HTML - no JavaScript involved.

Quote:
Originally Posted by Vonice View Post
-JavaScript that performs an age calculation. The script should
-Prompt the user for a date of birth (at least year and month)
to collect that information you need a form - again that's just HTML.

Quote:
Originally Posted by Vonice View Post
-Display the month and year entered by the user
-Display the current date (use the Date() object)
The easiest way for beginners to update a web page with output from JavaScript is using a div with an id and then using getElementById to reference it and innerHTML to replace its content. Take a look at the "hello world" example in the link in my signature for how to do this - it is lesson ONE in writing JavaScript.

The Date object is probably the hardest part of this for a beginner - you need to know what Date methods to use to set and get dates and parts of dates.

Quote:
Originally Posted by Vonice View Post
-Calculates and displays the (approximate?) age difference in Years, months
-Prints out "Happy Birthday" and counts each line for each year of age (use a loop!)
Those are the actual calculations that you need to perform in JavaScript before outputting anything. If you know how to add and subtract and do loops in JavaScript then that part should be easy but if you haven't been paying attention in class then you will not know how to do it. See the link in my signature for live examples of how to do those sorts of thing in JavaScript.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/

Last edited by felgall; 12-01-2012 at 06:19 AM..
felgall is offline   Reply With Quote
Reply

Bookmarks

Tags
assignment, homework, javascript, need help

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:39 AM.


Advertisement
Log in to turn off these ads.