All pastes #199920 Raw Edit

Something

public text v1 · immutable
#199920 ·published 2006-10-12 20:44 UTC
rendered paste body
In the JS in your HTML page that has the eventhandlers you should have:

<SCRIPT>
var url = "";
</SCRIPT>

then in the eventhandler for SelectCal, pass in form and url:

call = SelectCal(form, url)

and for SwitchCal:  call = SwitchCal(url)

then see changes to the functions below:



var request = null;
try {
  request = new XMLHttpRequest();
} catch (trymicrosoft) {
  try {
    request = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (othermicrosoft) {
    try {
      request = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (failed) {
      request = null;
    }
  }
}

if (request == null)
  alert("Error creating request object!");

function SwitchCals(url) {
	var url = "switchcals.php";
	request.open("GET", url, true);
	request.onreadystatechange = updatePage;
	request.send(null);
}

function updatePage() {
  if (request.readyState == 4) {
    var newCal = request.responseText;
    document.getElementById("gcal").innerHTML = newCal;
  }
}

function SelectCal(form, url) {
	calItem = form.calendars.selectedIndex;
	calNumber = form.calendars.options[calItem].value;
	alert(calNumber);
	url = "switchcals.php?calendars=" + calNumber;
	alert(url);
}