How to pass email from one form to another page's form with javascript
- by zac
I am trying to have an email signup form on one page populate the email block on another page by passing it through the url and pulling it out with document.write.
The first form is something like:
<form action="/sign-up">
<input type="text" name="passEmail"><input type="submit"></form>
And the recieving form is like :
<form name="theForm">
<input type='text' name='email'></form>
And I am trying a script like this
<SCRIPT LANGUAGE="javascript">
var locate = window.location
document.theForm.email.value = locate
var text = document.theForm.email.value
function delineate(str)
{
theEmail = str.indexOf("=") + 1;
return(str.substring(theEmail));
}
document.write(delineate(text));
</SCRIPT>
Instead of pulling the email after the = in the url it is pulling the entire url. Can someone help me accomplish this?