If your code isn't working as expected, try opening up Firefox's error console to check for (potentially) helpful error messages. If you get stuck, don't hesitate to ask the instructor or a teaching assistant for help.
Tip: Here are some handy keyboard shortcuts:
Select-All: Command-A (Mac), Control-A (Windows)
Copy: Command-C (Mac), Control-C (Windows)
Paste: Command-V (Mac), Control-V (Windows)
alertfunction is a "Do Something" method (it does something for us), the
promptfunction is a "Return Something" method (it returns a value to us). That value is being stored in a variable, and is then being used in the next call to
Mary, she should see an alert window that contains a message such as
Hello Mary, I am glad to see you!.
Tip: Don't forget that the "+" symbol can be used to combine two or more strings.
madLibfunction to construct a simple Mad Libs story. You should prompt for three words: one noun, one verb, and one adjective. Each word should be stored in an appropriately named variable. Then use an alert box to display a short story constructed using the words the user entered. A sample session might look like the following:
[prompt] Please enter a noun. [user enters] monkey [prompt] Please enter a verb. [user enters] jump [prompt] Please enter an adjective. [user enters] happy [alert] When I was walking to work today I saw a monkey! It was very happy and it made me want to jump. OR [alert] It's your turn to jump over the happy monkey.Be creative! If you wish, you may prompt for additional words and create a more involved story.
Edit the course "home page" you created in Lab 1 and add a link to your MadLibs page. For example,
COMP 105 Assignments
- Link to Mini-Lab 1: Numbers and Strings
- Link to Mad Libs Mini-Lab
In the link, refer to your new page with a relative pathname
which is just the name of the file (e.g.,
This tells the browser that the file to look for is in the same
directory or folder as the current file (your main COMP 105 web page,
in this case).
You do not want to give
a full or absolute pathname, like
because the location of your file on the
peopleftp.kzoo.edu server will not be the same as on
your own laptop or classroom computer.
If you worked in a team, each member of your group should do this, so each of you has a link to your MadLibs page.
people.kzoo.eduserver (remember that its host name for uploading is
peopleftp.kzoo.edu). Test that the link to the Mini-Lab works on the server by clicking on it from your home page.