The JavaScript code function $(id) { return document.getElementById(id); } window.onload = function() { $('myform').onsubmit = function() { var str1 = escape($('f1').value); var str2 = escape($('f2').value); var searchString = "f1=" + str1 + "&f2=" + str2; window.location = "receiveGet.html?" + searchString; return false; }; };