Hello.
I have a form which in the url of the page, displays variable information after a “?” I have javascript which captures the URL variable info and passes it to a hidden feild. I need to have a radio button which allows users to go to another iteration of of this form. The problem is, when users clicks the radio button and gets to the other form, none of the URL variables display since it is not part of the onclick=”location command.
Is there a way to have the second page display the first page’s URL variables after the ‘?’ ?
Any help is much appreciated.
I’ve tried the script below but does not work:
function getParams() {
var idx = document.URL.indexOf(‘?’);
var params = new Array();
if (idx != -1) {
var pairs = document.URL.substring(idx+1, document.URL.length).split(‘&’);
for (var i=0; i<pairs.length; i++) {
nameVal = pairs[i].split(‘=’);
params[nameVal[0]] = nameVal[1];
}
}
return params;
}
<body>
<SCRIPT LANGUAGE=”JavaScript”><!–
dealer_id = unescape(params[‘dealer_id’]);
document.write(‘<input name=”radiobutton” type=”radio” value=”radiobutton” onclick=”location=’consumer_contact.html?dealer_id=”‘ + dealer_id + ””>’);
//–></SCRIPT>