View Full Version : onClick set a variable

01-03-2004, 09:56 AM
I'm new to javaScript and want to create an online exam which marks the test online and emails me the result. Can I set a variable from onClick? how can I then email that variable?


01-03-2004, 07:52 PM
to set a variable is simple do it in a function when the function is called in the onClick

and for emailing it you are going to have to have some sort of emailing service set up on your server

01-03-2004, 08:01 PM
<form action="mailto:you@yourdain.com">
<input type="hidden" name="thevar">
<input type="button" value="Submit Your Score" onClick="this.form.thevar=yourvalue;this.form.submit()">