var message1, message2; document.forms.my.onsubmit = function() { message1 = this.one.value; message2 = this.two.value; return false; };