A Fun Web Application
The Joke application displays a joke and then waits for the visitor to click an Answer button. When the button is clicked, the answer is displayed inside a text field. Below shows the source code for the Javascript Joke page.
<HTML>
<HEAD>
<TITLE>A Javascript Joke</TITLE>
</HEAD>
<BODY>
<H1>A Javascript Joke</H1>
<P>Why did the chicken cross the road?</P>
<FORM>
<INPUT TYPE="button" VALUE="Punchline" OnClick="frmAnswer.txtAnswer.value='To cross the road.'">
</FORM>
<FORM NAME="frmAnswer">
<INPUT TYPE="text" NAME="txtAnswer">
</FORM>
</BODY>
</HTML>Output: