How to pass email from one form to another page's form with javascript
Posted
by zac
on Stack Overflow
See other posts from Stack Overflow
or by zac
Published on 2010-04-07T19:03:37Z
Indexed on
2010/04/07
19:13 UTC
Read the original article
Hit count: 313
JavaScript
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?
© Stack Overflow or respective owner