Hello,
I have a little form to check an url on my page www.jcrea-websolutions.be . On my page www.jcrea-websolutions.be/bestel.htm i have a form in iframe . How can i pass data from the first page to the iframe in the second page?
J-C
Hello,
I have a little form to check an url on my page www.jcrea-websolutions.be . On my page www.jcrea-websolutions.be/bestel.htm i have a form in iframe . How can i pass data from the first page to the iframe in the second page?
J-C
j-c, one method would be to embed the URL of the wanteddomainname that is typed in into the CHECK button onclick function (currently, <input class="button" type="submit" value="CHECK" onclick="lookup(); ">) such that your second page is called as http://www.jcrea-websolutions.be/bestel.htm?<<wanteddomainname>>.
HOW TO PASS THE WANTED DOMAIN NAME
<input class="button" type="submit" value="CHECK" onClick="window.open('http://www.jcrea-websolutions.be/bestel.htm'+'?'+document.getElementById('domainnam e').value,'_blank');">
On your second page, you would use more code to extract the parameter (the wanteddomainname following the ?) and then paste it as the value of the field <input class="text-input small-input" type="text" id="domainname" name="domainname">.
HOW TO INSERT THE WANTED DOMAIN NAME
You could use the following code to get the parameter from the passed URL:
var parameter = window.location.search.substring(1); // extracts parameter from url?parameter
To paste the parameter, you would use:
document.getElementById('domainname').value=parame ter
As this field is in an IFRAME the mechanism to get to it may be more tricky than I have described.
You should also have validation checking of the first field to block malicious code insertions; the jQuery Javascript Library probably does all of the above more tidily that I have just cobbled together.
Acorn
Bookmarks