Forum Moderators: open
My question is this:
I am making a website for a hotel which is using an external booking system on a different site. At the moment they have a simple link to their booking page on this site, from where you can enter dates, numbers etc.
Does anyone know if it is possible using javascript (or anything for that matter) to take a date typed in on the first site, and have it automatically sent to the booking site when you click the hyperlink, so that their form is filled in when it loads?
thanks
function getVar(name){
var url = window.location.toString();
var arr = url.split('?');
var no = arr.length;
if(no > 1){
var nArr = arr.slice(1);
for (var i = 0;i< nArr.length;i++)
{
var h = {name: "", value: ""}
var temp = nArr[i].split('=');
h.name = temp[0];
h.value = temp[1];
if(h.name == name){
return h.value;
}
}
}
}
document.form['name'].datefield.value = getVar("date");
note: script untested, just an example.
edit: script needs to resplit nArr's values at "&" to gather other vars before testing 'name'
then you would just need to pass the date in the url like, www.example.net?date=12/12/12
hope that helps.
[edited by: Kings_on_steeds at 4:13 pm (utc) on Mar. 22, 2009]
[edited by: eelixduppy at 5:33 pm (utc) on Mar. 22, 2009]
[edit reason] formatting [/edit]