general guidelines for project
reports.
Please be aware that your lab report will not (in general) contain the same sections as this one. Structure your report logically with sections reflecting the theme you choose for your report appropriate to your lab assignment.
The report theme the author chose in this particular assignment was the simplicity of the code needed to accomplish a seemingly complex task.
Linus Apple
MCS-170 Project 0
February 31, 2005
Hello Me Web Page
Introduction
Dynamic web pages are widely used throughout the Internet. In this
report, we demonstrate how to create a very simple interactive web page
that queries the user for his or her name and then says "hello".
Part 1 of this report describes the HTML code for the interactive web
page and part 2 discusses the testing of the page. Finally, there are
some concluding remarks.
Part 1: HTML Code
For our dynamic web page we will use HTML code and JavScript commands.
As a prototype for the HTML code for this project, I used the basic web
page we covered in class. This page does not do much - it just displays
the message "Hello World" - but it will be sufficient for our purposes.
On this basic page, I added two lines of JavaScript code to carry out
the desired action. First, to prompt the user for their name I used the
command:
me = prompt("Enter Your Name:","");
The "prompt" command opens a dialog box with the given string as a prompt
and an empty textbox for the user to type their reply. Once the user types
in their reply and hits the "Okay" button, the variable "me" is set to the
value of this reply string.
Next, to have the page say "Hello" I used the following JavaScript command:
document.write("Hello " + me);
The effect of this command is to have the browser display the words
"Hello" followed by the value of "me", which is the user's name.
The complete HTML code for the web page for this project is as
follows:
<html>
<!-- Example for a sample lab report in MCS 170 -->
<!-- This page asks for your name and says hello -->
<!---------------------------------------------------->
<head>
<title>Hello Me</title>
</head>
<body>
<p>
<h1 style = "text-align:center">Hello Me</h1>
</p>
<script type="text/javascript">
me = prompt("Enter Your Name:","");
document.write("Hello " + me);
</script>
</body>
</html>
Part 2: Testing of the Code
I tested this web page by loading it into a browser and checking that
it functioned properly. I have attached to this report a printout of
the web page which shows the correct action of the JavaScript
commands above.
Conclusion
Interactive web pages are the life-blood of the Internet. In this report we
saw how to create a very simple, yet interesting, example of an interactive
web page.