Exercise One

In this exercise, you will call the alert() method from both an onClick event handler, and from the javascript absolute URL; you will do this both from A (anchor) tags, as well as from button INPUTs in a form.

1. Create an HTML page. Make two hyper-references on the page using the A (anchor) tag. Create a form with one button INPUT in it, as well; the button should say "Click Me".

2. In your first A (anchor) tag hyper-reference, set the HREF attribute equal to "#" ("#" being the generic name reference in relative URL syntax; this will activate your A tag). Set the onClick event handler for the same A tag equal to "alert('Howdy');", which will invoke the alert() method, passing it the string argument, "Howdy".

3. In your second A (anchor) tag hyper-reference, set the HREF attribute to call the javascript absolute URL. The scheme_specific_part of the javascript absolute URL should be the same javascript code as in the previous step, alert('Howdy'); (NO SPACES).

4. Test your anchor tags; make corrections, if necessary.

5. In your form, set the onClick event handler for your button INPUT equal to the same code you used in the first two hyper-references, "alert('Howdy');".

6. Test your button INPUT; make corrections, if necessary.

View Solution Page.

Main Menu