eaweb
asked on
javascript to submit form to referrer
Hi
I have the following javascript that get the referrer url from this link (http://home.group.csd/online/weblink.htm?referrer=http://www.adobe.com/products/acrobat/readstep2.html)
<script type="text/javascript">
function getQueryVariable(referrer) {
var query = window.location.search.sub string(1);
var vars = query.split("&");
for (var x=0; x<vars.length; x++) {
var pair = vars[x].split("=");
if (pair[0] == referrer) {
return pair[1];
}
}
//alert('Query Variable ' + referrer + ' not found');
}
</script>
Using below form when submitting it i want the page to go to the referrer url (http://www.adobe.com/products/acrobat/readstep2.html)
<form name="refer" action="javascript:getQuer yVariable( 'referrer' )" method="get">
<input type="submit" name="Submit" value="Continue" class="buttonNormal">  ;
<input type="button" name="Submit" value="Close" class="buttonNormal" onClick="javascript:window .close()">
</form>
But in some way it is not working. What need to be done for the form to work? Is there a better way than what i have above?
I have the following javascript that get the referrer url from this link (http://home.group.csd/online/weblink.htm?referrer=http://www.adobe.com/products/acrobat/readstep2.html)
<script type="text/javascript">
function getQueryVariable(referrer)
var query = window.location.search.sub
var vars = query.split("&");
for (var x=0; x<vars.length; x++) {
var pair = vars[x].split("=");
if (pair[0] == referrer) {
return pair[1];
}
}
//alert('Query Variable ' + referrer + ' not found');
}
</script>
Using below form when submitting it i want the page to go to the referrer url (http://www.adobe.com/products/acrobat/readstep2.html)
<form name="refer" action="javascript:getQuer
<input type="submit" name="Submit" value="Continue" class="buttonNormal"> 
<input type="button" name="Submit" value="Close" class="buttonNormal" onClick="javascript:window
</form>
But in some way it is not working. What need to be done for the form to work? Is there a better way than what i have above?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window