...

View Full Version : IE getting bogged down



NancyJ
10-12-2006, 10:06 AM
I'm writing a task manager application and in FF and Opera its perfect, completely stable, no problems with it at all - no matter how fast I click around but in IE, even with just normal- moderately fast use, it bogs down and eventually IE hangs in just a couple of minutes usage - seconds if you click around really fast.
I'm no js wizz but I know there must be a way around this problem - I just cant seem to find it.



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Icelolly.com Task Management</title>
<style type = "text/css">
<!--
@import "taskmanager.css";
-->
</style>
<script type = "text/javascript">
<!--
onload = function()
{
try
{
xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Msxml2.XMLHTTP");

}
catch(e)
{
//do stuff
try
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e2)
{
///argh no ajax - fall over
}
}
user = 6;
activetab = 1;
message = 0;
orderby = "Date";
registerEvents();
}

function registerEvents()
{
if(document.getElementById)
{
tabRoot = document.getElementById("tab");
for(i=0; i<tabRoot.childNodes.length; i++)
{
node = tabRoot.childNodes[i];
if(node.nodeName=="LI")
{
node.className = node.id == activetab ? "active" : "";
try
{
result = node.addEventListener ? node.addEventListener('click', changeTab, false) : node.attachEvent('onclick', changeTab);

}
catch(e)
{
alert("couldnt assign event "+ e);
}
}
}

listRoot = document.getElementById("list");
for(i=0; i<listRoot.childNodes.length; i++)
{
node = listRoot.childNodes[i];
for(j = 0; j < node.childNodes.length; j++)
{
row = node.childNodes[j];
if(row.nodeName == "TR")
{
row.className = row.id == message ? "active" : "";
try
{
result = row.addEventListener ? row.addEventListener('click', changeMessage, true) : row.attachEvent('onclick', changeMessage);

}
catch(e)
{
alert("couldnt assign event " +e);
}
}
}

}

orderRoot = document.getElementById("headers")
{
orderRoot = orderRoot.childNodes[0].childNodes[0].childNodes[0];
{
for(i=0; i < orderRoot.childNodes.length; i++)
{
node = orderRoot.childNodes[i];
if(node.nodeName == "TD")
{
node.className = node.innerHTML == orderby ? "orderby" : "";
try
{
result = node.addEventListener ? node.addEventListener('click', changeOrder, false) : node.attachEvent('onclick', changeOrder);
}
catch(e)
{
alert("couldnt assign event "+e);
}
}
}
}
}
}
}

function changeTab(e)
{
activetab = e['target'] ? e['target']['id'] : window.event.srcElement.id;
target = "listPane";
if(activetab==4)
{
action = 'new';
document.getElementById('messagePane').style.display = 'none';
document.getElementById('headers').style.display = 'none';
}
else
{
action = 'list';
document.getElementById('messagePane').innerHTML = '';
document.getElementById('headers').style.display = 'block';
}
if(activetab==5)
{
action = 'all';
}



loadURL('proctaskmanager.php', 'tab='+activetab+'&user='+user+'&action='+action+'&message='+message+'&orderby='+orderby);
}

function changeMessage(e)
{
message = e.target ? e.target.parentNode.id : window.event.srcElement.parentNode.id;
target = "messagePane";
document.getElementById('messagePane').style.display = 'block';
loadURL('proctaskmanager.php', 'tab='+activetab+'&user='+user+'&action=message&message='+message+'&orderby='+orderby);
}

function changeOrder(e)
{
orderby = e.target ? e.target.innerHTML : window.event.srcElement.innerHTML;
target = "listPane";
action = 'list';
if(activetab==4)
{
action = 'new';
}
else if(activetab==5)
{
action = 'all';
}

loadURL('proctaskmanager.php', 'tab='+activetab+'&user='+user+'&action='+action+'&message='+message+'&orderby='+orderby);
}


function loadURL(url, args)
{
xmlhttp.open("GET", url+"?"+args);
xmlhttp.onreadystatechange = handleResponse;
xmlhttp.send(null);
}

function handleResponse()
{
if(xmlhttp.readyState == 4 &&xmlhttp.status ==200)
{
if(document.getElementById(target).innerHTML = xmlhttp.responseText)
{
registerEvents();
}
}
}
-->
</script>
</head>
<body>
<ul id = "tab"><li class = "active" id = "1">Incomplete</li><li id = "2">Active</li><li id = "3">Complete</li><li id = "4">New</li><li id = "5">Show All Tasks</li></ul>

<div id = "headers"><table width = "95%"><tr><td width = "15%">Date</td><td width = "70%">Subject</td><td width = "10%">From</td><td width = "10%">Priority</td></tr></table></div>
<div id = "listPane"><table width = "95%" id = "list"><tr id = "2"><td width = "15%">00/00/0000 00:00</td><td width = "70%">Test Message 1</td><td width = "10%">Bilbo Baggins</td><td width = "10%">Low</td></tr>

<tr class = "active" id = "1"><td width = "15%">12/05/2006 14:40</td><td width = "70%">Test Message 1</td><td width = "10%">Joanne Bloggs</td><td width = "10%">None</td></tr>

</table></div>
<div id = "messagePane"><div class = "messageheader"><strong>From:</strong> Jo Bloggs <strong> at </strong>12/05/2006 14:40 <strong>Priority</strong> None<br />
<strong>Subject: </strong>Test Message 1</div>

<p class = "message">This is a test message</p></div>

</body>
</html>

Ancora
10-12-2006, 12:13 PM
I think you need the "true" to make it asynchonous.



xmlhttp.open("GET", url+"?"+args, true);

NancyJ
10-12-2006, 01:44 PM
thats fixed it - cheers.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum