CS 101 - Intro to Computing, Spring 2008

Lab 6

JavaScript

For this assignment, we will want to write some JavaScript code that will allow the user the change a section of the web page. For this we will need to use the id attribute of the <div> tag.

For this lab, we will want to explore the HTML DOM innerHTML Property. This property allow us to have access to the HTML text that was used to describe an element of a web page. This access allows us to both retrieve or change the current element. Check out http://www.w3schools.com/htmldom/prop_anchor_innerhtml.asp for a simple discussion of this and the following "TryIt" sections:

For the lab, we will also want to use the JavaScript built in function prompt().

Lab Assignment 6

Due: Tuesday 2/26/2008 by 11:59 pm

For this lab assignment, complete the following:

  1. Create an HTML file that lists:

    When the button is clicked, the JavaScript function is to prompt the user for some input and whatever the user inputs is added/appended to the <div> section of the web page. Use the string concatentation operator "+" to add/append the new text to the <div> section of the web page. Note that if the user types in HTML tags, they will be processed by the browser.

  2. This web page must be placed in your web space (in your WWW directory) on your CS account.

  3. You are also required to put a link on your CS Home Page to the page you created for this lab.

    Verify that your link and the file are viewable via a web browser from the URL of:

         http://www.cs.uic.edu/~USERID
    
    where USERID is your CS account login name.
    
    You can check this out via the link to your home page on the CS 101 Student List page. Once you are at your home page, follow the link you added to your home page for this lab assignment.

  4. You are also to submit the HTML file electronically by using the UNIX turnin command.

    To use the UNIX turnin command to electronically hand-in your html file using the project name of lab6. To submit the file in <filename> for lab6, the turnin command is entered as:

         turnin -c cs101 -p lab6 <filename>
    
    To verify what you submitted using the turnin command type:
         turnin -c cs101 -p lab6 -v
    

Grading Criteria