The
form is made with normal HTML code. The only difference is: OnClick="alert1()"
OnClick represents an event, in this case a mouse click, that
needs to performed to call the function. alert1() is the name
of the function which has already been defined in the HEAD of
the document.
|
<BODY>
<form>
<input TYPE="button"
VALUE="Click Me"
ONCLICK="alert()"> |
We
know that there is a function because of the () -two brackets at
the end of the ONCLICK line. The function is only a name however,
and we must give it some code. The code must be between {}. Don't
forget this is done in the <head></head> part of the
document. The code is on the right. |
<HEAD>
<Script Language="JavaScript">
<!--//
function alert()
{alert("You Clicked!");}
//-->
</Script>
</HEAD>
|