var lastpage = "notset";
function DICKBUTT()
{
var request;
try {
request = new XMLHttpRequest();
}
catch (n)
{
try
{
request = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (n2)
{
try
{
request = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (n3)
{
alert("Your Browser does not support DICKBUTT, which is needed to view this website. Please upgrade to the latest version of your favorite browser.");
window.location = "../Index.php";
return false;
}
}
}
return request;
}
function updatePage(location)
{
if (thing.readyState == 4)
{
if (thing.status !== 200)
{
document.getElementById(location).innerHTML = "Error, "+thing.status+"";
}
else
{
document.getElementById(location).innerHTML = thing.responseText;
}
}
}
function GetContent(url, method, place)
{
switch (method){
case "GET":
var kl = window.location.href.indexOf("?",0);
lastpage = window.location.href.substr(kl);
document.getElementById(place).innerHTML = "<center>Loading, please wait...<br /><img src='../gif/load.gif' /></center>";
thing = new DICKBUTT();
thing.open("GET", url, true);
thing.onreadystatechange = updatePage(place);
thing.send(null);
lastpage = GetDo();
break;
case "POST":
document.getElementById(place).innerHTML = "<center>Your request is being processed, please wait...<br /><img src='../gif/load.gif' /></center>";
thing = new DICKBUTT();
thing.open("POST", to, true);
thing.setRequestHeader("Content-type", "applicationx-www-form-urlencoded");
thing.setRequestHeader("Content-length", params.length);
thing.setRequestHeader("Connection", "close");
thing.onreadystatechange = updatePage(place);
thing.send(params);
break;
}
}
function GetDo()
{
var loc = window.location.href;
var idx = loc.indexOf("?", 0);
var stn = loc.substr(idx);
return stn;
}
function CheckDo()
{
if (GetDo().length > 1 && GetDo() != lastpage)
{
lastpage = GetDo();
GetContent("maincontent.php"+GetDo(), "GET", "here");
return true;
}
return false;
}
function INI()
{
if (CheckDo() == false)
{
GetContent("maincontent.php?do=home", "GET", "here");
}
}
The Problem?
Suddenly, my DICKBUTT is not working at all!. I am SURE something is wrong with updatePage(); because it stops execution when it is called...
EDIT: Updated : (
Here is what JSlint.com says
Error:
Implied global: ActiveXObject 13, XMLHttpRequest 7, alert 23, document 38 53, params 65, thing 34 54, to 63, window 24 51 75
EDIT: updated..
Please help, I need to finish this website in under a week!