Assignment 2
1. Here are the
steps to writing your first JavaScript program.
- Set up your desktop.
- Leave this browser
window open so you can see the instructions.
- Open a second
browser window so you can view your web page document
- Open up Notepad, or
any other text editor you want to use for this. Nothing fancy is needed,
just a text editor.
- Open your newAssign.htm document to use as a
basic web page by following these simple steps. Save it as 2hello.htm in
your folder.
- Add the lines of JavaScript to display
"Hello World".
- First add the
<SCRIPT> tags you need in the body of the web page. Look back if you need to.
- Be sure to add the
HTML comment tags to hide your script from older browsers.
- Use the document.write() method to display the message "Hello
World" AND use an alert box the display a "Hello World"
alert box.
- Check by opening the file "2hello.htm"
in your browser and HOPE it works. If not, study any parts that look wrong
and try to fix it so it works right. Don't try to add too much fancy stuff
for this program, since we will get to learn more features as we go. If
you are really stuck about how to make it work, click on this link, but not
until you have REALLY tried. Don't click here until
you have tried it for yourself.
2. Here is
another task for you to try.
Use the 'window.status()' method to echo
the phrase "Hello World" in the status bar of your web page's browser
window. Add
window.status="Hello World";
inside the <SCRIPT> tags
and view the page again to see the changes in the status bar.
Return to Top of Page | Back to Main Menu