<html> <head> <title>Program #3</title> </head> <body> <p>How much wood would a woodchuck chuck if a woodchuck could chuck wood?</p> <input type="button" value="Click for Answer" onclick="document.getElementById('outputDiv').innerHTML='<p>I know this joke is old and sucks, but I couldn't think of anything else.</p>'; alert('A woodchuck would chuck all the wood if a woodchuck could chuck wood.');"> <hr><div id="outputDiv"> <p>This joke is a classic.</p> </div> </body> </html>
EDIT: Hahaha, in posting this, I noticed the problem thanks to the syntax highlights. My punctuation was causing the onclick to close. Any way I can avoid that?
This post has been edited by TonicX57: 20 September 2012 - 08:50 PM