Submit Sends Email And Loads New Page

[Total: 0    Average: 0/5]

This shows how to have a submit type button in a form cause a mail message to be sent, and have the current page load a different URL.

Body Code:

<form name=f1>
<input type=text name=who value="me@somewhere.com"><BR>
<input type=text name=where value="http://www.js-examples.com"><BR>
<input type=button onclick="doit()" value="submit">
</form>
<script type=text/javascript>
function doit() {
  document.location = "mailto:"+document.f1.who.value;
  setTimeout("document.location = document.f1.where.value;",300);
}
</script>

Times Viewed: 1

Leave a Reply

Your email address will not be published. Required fields are marked *