LESSON 46: INTRODUCTION TO JAVASCRIPT

  1. Study the index cards on Introduction To JavaScript. I've included a hard copy of these index cards, for your convenience. Be sure that you can answer all the following questions, which are fair game for quizzes and tests:
    1. Fill in the blanks: JavaScript is a            language developed by            to enable Web authors to design            sites.
    2. Has the general-purpose core of the JavaScript language been embedded in Netscape Navigator, Internet Explorer, and other web browsers?
    3. What is a script?
    4. What is a scripting language?
    5. What does object-oriented mean?
    6. Is JScript the same as JavaScript?
    7. What is JScript?
    8. Is Java the same as JavaScript?
    9. Who invented JavaScript?
    10. What is Java? Who invented it?
    11. What was the original name for JavaScript?
    12. Why was the original name of JavaScript changed?
    13. Are there languages other than JavaScript that can be embedded in a web page?
    14. Give an example of a language other than JavaScript that can be embedded in a web page.
    15. Can you perform math computations with JavaScript?
    16. Can you control document appearance and content with JavaScript?
    17. Can you put the current time and date in a document with JavaScript?
    18. Can you display different content on different platforms with JavaScript?
    19. Can you pop up dialog boxes to display messages and get user input with JavaScript?
    20. Can you open and close new browser windows with JavaScript?
    21. Can you interact with HTML forms with JavaScript?
    22. Can you verify that form input is correct before sending it be processed, with JavaScript?
    23. Can you display a special message in the status line when the mouse hits a certain link, with JavaScript?
    24. Can you draw graphics with JavaScript?
    25. Can you dynamically generate images, tables, frames, forms, and fonts with JavaScript?
    26. Can you read files with JavaScript?
    27. Can you write files with JavaScript?
    28. Why can't you read or write files with JavaScript?
    29. Does JavaScript support networking?
    30. What is a "cookie"?
    31. Is a "cookie" stored on the server's machine, or the client's machine?
    32. What is the purpose of a "cookie"?
    33. Can JavaScript read and write cookie values?
    34. What is a network?
    35. How do you read the mathematical expression " 5! "?
    36. What is the value of " 5! "?
  2. Do worksheet items WJ1.1 through WJ1.5 in Introduction To JavaScript.
  3. Read page 461 to the middle of page 462 in the Weasel Book, and answer the following questions (which are fair game for quizzes and tests).
    1. Can you create mouse rollover effects with JavaScript?
    2. What is a "snippet" of code?
    3. Where is JavaScript code usually placed?
    4. Can JavaScript code go in the head of an HTML document?
    5. Can JavaScript code go in the body of an HTML document?
    6. Give the syntax for embedding JavaScript code in an HTML document:
    7. What is the purpose of the comment tags inside the <SCRIPT LANGUAGE="JavaScript"> container?
    8. Suppose you have a really old browser that doesn't understand JavaScript. If there aren't comment tags inside a SCRIPT container, what might happen?
    9. What are the two basic parts to most JavaScript applications?
  4. Follow through these exercises, to give you practice with the sample script discussed in pages 462 to 464 in the Weasel book:
    1. Type in the code on the bottom of page 462 to the top of page 463. Replace 'mozart.html' with a file of your own. Also, change the clickable area of the anchor tag to some suitable text that goes along with your replacement file. Try it out, and make sure that it works!
    2. Some code from the book is repeated here, for easy reference in the questions that follow:
      <SCRIPT LANGUAGE="JavaScript">
      function openWin(URL) {
      aWindow = window.open(URL,"composerwindow","toolbar=no,width=350,
        height=400,status=no,scrollbars=yes,resize=no,menubar=no");
      }
      </SCRIPT>
    3. The way the source code is formatted here, the line beginning with "aWindow = " is broken into two separate lines. Does it work, if you put it on two different lines when you're writing your source code?
    4. A function is being defined in this code. How do you know this?
    5. What is the name of the function that is being defined?
    6. How many input(s) does the function take?
    7. How many argument(s) does the function take?
    8. Change your source code by changing the two appearances of "URL" to "input". Does it still work?
    9. Change your source code by changing the two appearances of "URL" to "address". Does it still work?
    10. What is "window.open()"?
    11. How many input(s) does "window.open()" take?
    12. What is the first input to "window.open()"?
    13. What is the second input to "window.open()"?
    14. What is the third input to "window.open()"?
    15. Change the source code so that the side of the new window is 500 pixels wide and 200 pixels high.
    16. Change the source code so that the new window will have a status bar, but will not have any scrollbars.
    17. The source code that "calls" the function is shown below, for easy reference in the questions that follow:
      <A HREF="javascript:openWin('mozart.html');">Mozart</A>
    18. Rewrite the code so that the new window will hold the file "myfile.htm" and the the clickable area will say "This is MY file!"
    19. Try changing "openWin" (with a capital W) to "openwin" (without a capital letter). Does it still work? What have you learned?
    20. Try changing "javascript" to "JavaScript". Does it still work?
    21. Remove the "javascript:". Does it still work?
  5. Read page 464 to the middle of page 465 in the Weasel Book. You may also want to refer to pages 550 to 551, to get additional information on some event handlers. Please answer the following questions (which are fair game for quizzes and tests).
    1. What is the common name for actions like "clicking a link", "moving the mouse over an element", or "loading a page"?
    2. In JavaScript, what is used to tie specific functionality to events?
    3. What does an "event handler" do?
    4. Is there an event handler for when focus is applied to an object? If so, what is it?
    5. Is there an event handler for when a pointer button is clicked? If so, what is it?
    6. Is there an event handler for when a pointer button is double-clicked? If so, what is it?
    7. Is there an event handler for when a key is pressed down? If so, what is it?
    8. Is there an event handler for when a key is pressed and released? If so, what is it?
    9. Is there an event handler for when a key is released? If so, what is it?
    10. Is there an event handler for when an element value changes? If so, what is it?
    11. Is there an event handler for when focus is removed from an element? If so, what is it?
    12. Is there an event handler for when all frames have been loaded? If so, what is it?
    13. Is there an event handler for when a pointer button is pressed down? If so, what is it?
    14. Is there an event handler for when a pointer is moved within the element? If so, what is it?
    15. Is there an event handler for when a pointer is moved out of an element's space? If so, what is it?
    16. Is there an event handler for when a pointer is moved into an element's space? If so, what is it?
    17. Is there an event handler for when a pointer button is released? If so, what is it?
    18. Is there an event handler for when a form is reset? If so, what is it?
    19. Is there an event handler for when some text is selected? If so, what is it?
    20. Is there an event handler for when a form is submitted? If so, what is it?
THE QUIZ OVER THIS LESSON WILL CONSIST OF:
Prepare for the quiz over this section by practicing below.
Questions are asked in random order.
You can generate a printable quiz with solutions.








How many problems would you like on the quiz? (65 max)