Beffic
05-24-2009, 03:14 PM
Okay so I have two div's that I am trying to get to automatically update. I can get the charinfo to update but not the stats div. It just keeps trying to load. So I am not very good with java script and can't find the problem... any help?
<?php
include("../connect.php");
include("head.php");
?>
<center><table class="content">
<tr><td><div id="inventory">
<h3>Inventory</h3>
<p>*Double click to Equip/Unequip<br>*Red=Equipped</p>
<?php include("inventory.php"); ?>
<hr>
<p>News: This game is in beta stage as you can see and everything is a bit basic. No worries. I am working on making the game much more better including graphics and such. Your Admin at Jez-Your Productions!</p>
</div></td><td>
<h3>Character Info.</h3>
<div id="charinfo" rows="25" cols="95" readonly></div><br><hr>
<div id="location">
<h3>Location</h3>
</div></td><td>
<h3>Stats</h3>
<div id="stats" rows="25" cols="95" readonly></div><br>
<hr>
<div id="navigate">
<form>
<select id="menu" onchange="go()">
<option>--Navigate--</option>
<option value="hospital.php">Hospital</option>
<option value="shrine.php">Shrine</option>
<option value="statpointdistributer.php">Stat Point Distributer</option>
<option>--Misc--</option>
<option value="Top/index.php">Top Players</option>
</select>
</form>
</div></td></tr>
</table>
<div id="fightframe"><iframe src="Fight/index.php" style="background-color: #AABBD7;" frameborder="0px" width="99%"></iframe></div>
<hr>
<table class="chat"><tr><td><?php include("Chat/index.php"); ?></td></tr></table>
</center>
<script type="text/javascript">
/* Settings you might want to define */
var waittime=500;
/* Internal Variables & Stuff */
document.getElementById("stats").innerHTML = "Getting stats information...";
document.getElementById("charinfo").innerHTML = "Getting chatacter information...";
var xmlhttp = false;
var xmlhttp2 = false;
/* Request for Reading the Chat Content */
function ajax_load(url) {
if(window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
if(xmlhttp.overrideMimeType){
xmlhttp.overrideMimeType('text/xml');
}
} else if(window.ActiveXObject){
try{
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
} catch(e){
}
}
}
if(!xmlhttp) {
alert('Giving up :( Cannot create an XMLHTTP instance');
return false;
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState==4) {
document.getElementById("stats").innerHTML = xmlhttp.responseText;
zeit = new Date();
ms = (zeit.getHours() * 24 * 60 * 1000) + (zeit.getMinutes() * 60 * 1000) + (zeit.getSeconds() * 1000) + zeit.getMilliseconds();
intUpdate = setTimeout("ajax_load('stats.php?x=" + ms + "')", waittime)
}
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState==4) {
document.getElementById("charinfo").innerHTML = xmlhttp.responseText;
zeit = new Date();
ms = (zeit.getHours() * 24 * 60 * 1000) + (zeit.getMinutes() * 60 * 1000) + (zeit.getSeconds() * 1000) + zeit.getMilliseconds();
intUpdate = setTimeout("ajax_load('character.php?x=" + ms + "')", waittime)
}
}
xmlhttp.open('GET',url,true);
xmlhttp.send(null);
}
var intUpdate = setTimeout("ajax_load('stats.php')", waittime);
var intUpdate = setTimeout("ajax_load('character.php')", waittime);
</script>
<?php
include("../connect.php");
include("head.php");
?>
<center><table class="content">
<tr><td><div id="inventory">
<h3>Inventory</h3>
<p>*Double click to Equip/Unequip<br>*Red=Equipped</p>
<?php include("inventory.php"); ?>
<hr>
<p>News: This game is in beta stage as you can see and everything is a bit basic. No worries. I am working on making the game much more better including graphics and such. Your Admin at Jez-Your Productions!</p>
</div></td><td>
<h3>Character Info.</h3>
<div id="charinfo" rows="25" cols="95" readonly></div><br><hr>
<div id="location">
<h3>Location</h3>
</div></td><td>
<h3>Stats</h3>
<div id="stats" rows="25" cols="95" readonly></div><br>
<hr>
<div id="navigate">
<form>
<select id="menu" onchange="go()">
<option>--Navigate--</option>
<option value="hospital.php">Hospital</option>
<option value="shrine.php">Shrine</option>
<option value="statpointdistributer.php">Stat Point Distributer</option>
<option>--Misc--</option>
<option value="Top/index.php">Top Players</option>
</select>
</form>
</div></td></tr>
</table>
<div id="fightframe"><iframe src="Fight/index.php" style="background-color: #AABBD7;" frameborder="0px" width="99%"></iframe></div>
<hr>
<table class="chat"><tr><td><?php include("Chat/index.php"); ?></td></tr></table>
</center>
<script type="text/javascript">
/* Settings you might want to define */
var waittime=500;
/* Internal Variables & Stuff */
document.getElementById("stats").innerHTML = "Getting stats information...";
document.getElementById("charinfo").innerHTML = "Getting chatacter information...";
var xmlhttp = false;
var xmlhttp2 = false;
/* Request for Reading the Chat Content */
function ajax_load(url) {
if(window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
if(xmlhttp.overrideMimeType){
xmlhttp.overrideMimeType('text/xml');
}
} else if(window.ActiveXObject){
try{
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
} catch(e){
}
}
}
if(!xmlhttp) {
alert('Giving up :( Cannot create an XMLHTTP instance');
return false;
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState==4) {
document.getElementById("stats").innerHTML = xmlhttp.responseText;
zeit = new Date();
ms = (zeit.getHours() * 24 * 60 * 1000) + (zeit.getMinutes() * 60 * 1000) + (zeit.getSeconds() * 1000) + zeit.getMilliseconds();
intUpdate = setTimeout("ajax_load('stats.php?x=" + ms + "')", waittime)
}
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState==4) {
document.getElementById("charinfo").innerHTML = xmlhttp.responseText;
zeit = new Date();
ms = (zeit.getHours() * 24 * 60 * 1000) + (zeit.getMinutes() * 60 * 1000) + (zeit.getSeconds() * 1000) + zeit.getMilliseconds();
intUpdate = setTimeout("ajax_load('character.php?x=" + ms + "')", waittime)
}
}
xmlhttp.open('GET',url,true);
xmlhttp.send(null);
}
var intUpdate = setTimeout("ajax_load('stats.php')", waittime);
var intUpdate = setTimeout("ajax_load('character.php')", waittime);
</script>