JAVASCRIPT 101 - P2PU
Week 5
TRACK 1 - Javascript Videos
Please watch the videos in the links listed below. Some links may contain further notes and links to resources covered in the videos. After watching the videos, reflect on the questions, discuss them on the forums, post your reflections on your blogs. The assignments are for practicing the concepts learned. You can discuss them on the forums, and upload them on your blog or any open source repository where your course peers and facilitators can review and comment on them.
Questions for reflection (please reflect on your blog and discuss in comments below):
  1. Why is it better to use either trickling or bubbling of events? Why not just give the event to the node on which it was invoked?
  2. Can you think of one situation where you would want to prevent the browser from submitting a form after a user has clicked on the 'submit' button? How would you achieve this?
Homework:
  1. 12.1 of Eloquent Javascript
  2. 12.2 of Eloquent Javascript
  3. 13.1 of Eloquent Javascript
  4. Create an HTML page and some Javascript to allow a user to add n numbers. First display a simple form with the question "How many numbers do you want to add (max is 10)". The user should enter a number between 2 to 10 and click on a button in the form. You have to validate the answer. If the user has entered a correct value (between 2 and 10), then dynamically create a form with n text input fields and an "Add" button. Once the form is displayed the user will enter n numbers in the n input fields and when they click on the "Add" button, dynamically create a span element with the result. You will have to perform validation on the values entered in the input fields to make sure that they are numbers. If they are not numbers, display an alert dialogue with an error message.
TRACK 2 - Eloquent Javascript
Please read the material from the links listed below. After reading, reflect on the questions, discuss them on the forums, post your reflections on your blogs. The assignments are for practicing the concepts learned. You can discuss them on the forums, and upload them on your blog or any open source repository where your course peers and facilitators can review and comment on them.
Questions for reflection (please reflect on your blog and discuss in comments below):
  1. What factors make accessing nodes according to their structural order (by using the 'firstChild' and 'lastChild' properties, for example) an inefficient and potentially unreliable approach? What alternatives are available?
  2. How does CSS play a role in JavaScript's interactive possibilities with the DOM? What are a few of the techniques related to this?
  3. Identify some of the browser events JavaScript is capable of interpreting. What might the practical applications be?
Homework:
  1. 12.1 of Eloquent Javascript
  2. 12.2 of Eloquent Javascript
  3. 13.1 of Eloquent Javascript
  4. Create an HTML page and some Javascript to allow a user to add n numbers. First display a simple form with the question "How many numbers do you want to add (max is 10)". The user should enter a number between 2 to 10 and click on a button in the form. You have to validate the answer. If the user has entered a correct value (between 2 and 10), then dynamically create a form with n text input fields and an "Add" button. Once the form is displayed the user will enter n numbers in the n input fields and when they click on the "Add" button, dynamically create a span element with the result. You will have to perform validation on the values entered in the input fields to make sure that they are numbers. If they are not numbers, display an alert dialogue with an error message.
Return to course home page
Please use the commenting system below for technical or other questions related to this week of the course.