i’m using google gadget to write a short script and try to insert to google site.
When user press Go button, javascript function is triggered and everything works fine, but when user press Enter, error occurs:
Missing or malformed url parameter
I’m not sure it’s caused by my code or google gadget/site.
My html code:
<form name="theform">
<input type="text" size="20" id="search"/>
<INPUT TYPE="submit" VALUE="Go!" ONCLICK="GotoURL(this.form)">
</form>
javascript function
function GotoURL(dl) {
var mySearch = document.getElementById("search").value;
url='some_url'+mySearch;
window.open(url,'_blank');
}
Thanks
You should use the
onsubmitevent on the form instead of theonclickevent of the button:Make sure that the
GotoURL()function returnsfalseto prevent the form from actually submitting.