var xmlHttp;
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function AutoSave()
{
var CurrLocation = new String (window.location)
var LocationSplit = CurrLocation.split("/")
var server = LocationSplit[0] +"//" + LocationSplit[2]
var path = document.forms[0].dbpath.value
var pos=0;
currURL = (document.location.href).toLowerCase();
if (trim(server) == "") {
pos = currURL.indexOf('://');
if (pos < 0 )
{
var CurrLocation = new String (window.location)
var LocationSplit = CurrLocation.split("/")
var server = LocationSplit[0] +"//" + LocationSplit[2]
}
//server = "http://Localhost" // PUT YOUR SERVERNAME HERE
else
{
pos += 3;
pos = currURL.indexOf('/', pos);
server = currURL.substring(0, pos)
}
}
if( trim(path) == "" )
{
if( pos > 0 )
{
newPos = currURL.indexOf('.nsf',pos);
if (newPos > 0)
{
path = currURL.substring(pos+1,newPos+4)
}
}
}
//Javascript index starts at 0, so need to decrement the column by -1
var args='&docID=' + document.forms[0].DocID.value + "&testing=" + document.forms[0].Testing.value
vurl = trim(server)+"/"+trim(path)+"/UpdateMyDocument?openagent" + args
alert(vurl)
createXMLHttpRequest(); // build update string
alert("1")
//xmlHttp.onreadystatechange = this.handleStateChange;
alert("2")
xmlHttp.open("GET" ,vurl ,true);
alert("3")
xmlHttp.send(null);
alert("4")
//UpdateMyDocument
}
function trim(sStr)
{
var iI = 0;
var iJ = 0;
var iTam = 0;
var sAux = "";
iTam = sStr.length;
if(iTam==0) return(sStr);
for(iI=0; iI= iTam) return("");
for(iJ=iTam - 1; iJ>=0; iJ--)
if(sStr.charAt(iJ)!=' ') break;
return(sStr.substring(iI,iJ+1));
} //End of trim
|