Your HTML page might initially look like the following (which you can copy and paste into a file):
Having a script in the body will work for parts 1 and 3 below, but for part 2 (and possibly part 3) you might need a script in the head. I suggest that you place your files in your personal DCS web space (this will be essential for part 3 below). Instructions on how to do this and what the resulting URLs will look like are given on the student web page wiki entry.
The three tasks are as follows:
window.prompt) for two integer values and will output the larger of the two values using the following HTML:
<p>The larger of ?? and ?? is ??</p>with
??replaced by the appropriate values. The values entered by the user are assumed to be strings, so you will need to use the
parseIntfunction to convert each value into an integer necessary for the comparison to return correct results. You may find this slide helpful.
larger(x, y), which returns the larger of 2 values, is called. This function should be defined in the
headof your HTML page. You may find this slide and the one which follows it helpful.
authorname as a separate paragraph in the HTML document being displayed. You may find this slide and this one helpful.