Hey,
Dit is mijn code:
De readystate veranderd 4 keer maar de status blijft 0.
Weet iemand hoe dit komt?
Mvg,
alemaalte
Dit is mijn code:
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function screen()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("frame").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","screen.php",true);
xmlhttp.send();
}
function login_check(id)
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
alert(xmlhttp.readyState);
alert(xmlhttp.status);
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
alert("test");
alert(xmlhttp.responseText);
}
if (xmlhttp.readyState==4 && xmlhttp.status==404)
{
alert("test");
alert(xmlhttp.responseText);
}
}
xmlhttp.open("GET","login.html",true);
xmlhttp.send();
}
function changeColor(id, color) {
element = document.getElementById(id);
event.cancelBubble = true;
oldColor = element.currentStyle.background;
element.style.background = color;
}
function login(id) {
element = document.getElementById(id);
event.cancelBubble = true;
if(element.style.height != "50px")
{
element.style.height = "50px";
element.innerHTML = id+"</br><input type="password" name="pass" />";
}
else
{
login_check("test");
}
}
function unshow(id) {
element = document.getElementById(id);
event.cancelBubble = true;
element.style.height = "30px";
element.innerHTML = id;
}
</script>
</head>
<body>
<div id="frame">
<div id="login">
<div class="user" id="Stewie" ondblclick="unshow(this.id);" onClick="login(this.id);" onMouseOver="changeColor(this.id, #537FA6);" onMouseOut="changeColor(this.id, #114261);">
Stewie
</div>
<div class="user" id="Brian" ondblclick="unshow(this.id);" onClick="login(this.id);" onMouseOver="changeColor(this.id, #537FA6);" onMouseOut="changeColor(this.id, #114261);">
Brian
</div>
<div class="user" id="Meg" ondblclick="unshow(this.id);" onClick="login(this.id);" onMouseOver="changeColor(this.id, #537FA6);" onMouseOut="changeColor(this.id, #114261);">
Meg
</div>
<div class="user" id="Peter" ondblclick="unshow(this.id);" onClick="login(this.id);" onMouseOver="changeColor(this.id, #537FA6);" onMouseOut="changeColor(this.id, #114261);">
Peter
</div>
</div>
</div>
</body>
</html> De readystate veranderd 4 keer maar de status blijft 0.
Weet iemand hoe dit komt?
Mvg,
alemaalte