Hello everybody!
I have a serious problem with my diploma work!
So here it is:
My ajax.js file cannot be executed. It does nothing when I click on the buttons... Here's the ajax.js code:4
function opensave(type){
url="open.php";
content=replacer("editor");
var xmlhttp=if(window.XMLHttpRequest){
new XMLHttpRequest();
} else if(){
new ActiveXObject("Microsoft.XMLHTTP");
};
xmlhttp.onreadystatechange=stateChanged();
if(type="read"){
xmlhttp.open("GET",url,true);
url+="?open=r&filename="+document.getElementById("filename").value+"&extension="+document.getElementById("extension").value;
xmlhttp.send(null);
} else if(type="write"){
xmlhttp.open("POST",url,true);
setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send("open=w&filename="+document.getElementById("filename").value+"&extension="+document.getElementById("extension").value+"&content="+content);
};
function stateChanged(){
if (xmlhttp.readyState==4){
processdata(xmlhttp.responseText);
};
};
};//********************************************************************************************
function replacer(id){
str=document.getElementById(id).value.replace(/"/g,"%dquot%");
return str;
};//********************************************************************************************
function processdata(response){
response=response.split("<!--//split-->")
document.title=response[0];
content=response[1].replace("%dq", /"/q);
document.getElementById("editor").innerHTML=content;
};//********************************************************************************************
The page which is linked to, doesn't want to "call" it. These methods were implemented in the other JS file, but it messed up the whole thing, so I've separated them.
My buttons, which calls the "opensave" method are:
<input type="button" value="OPEN" class="buttons" onclick="opensave('r')" /><br />
<input type="button" value="SAVE" class="buttons" onclick="opensave('w')" /><br />
My php file - where these buttons are - contains no DTD. Could that be a problem? I've used "Transitional" DTD, but them my PHP did wanted to work properly. Did nothing with DTD. Didn't loaded the image, didn't execute the JavaScript...
Please help, coz this is a big part of my diploma work, and I've got only 26 days to finish it with a big presentation too... :P
Thank u guys and girls! =)
Be nice everybody! =)