Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 776 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     Javascript :

IE Memory leak problem

Thread title: IE Memory leak problem
Closed Thread    
    Thread tools Search this thread Display Modes  
06-28-2007, 04:11 PM
#1
thetarget is offline thetarget
thetarget's Avatar
Status: Junior Member
Join date: Jun 2007
Location:
Expertise:
Software:
 
Posts: 35
iTrader: 0 / 0%
 

thetarget is on a distinguished road

  Old  IE Memory leak problem

PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<
html>
<
head>
<
meta http-equiv="content-type" content="text/html; charset=windows-1250">
<
meta name="generator" content="Me and you TagIt!">
<
meta name="keyword" content="Me and you TagIt!, tagIt,tag,chat,It,me,and,you,me and, and you, me you, you and, and me,you tag, you tagIt!">
<
title></title>
<
script type="text/javascript" language="javascript">  
  function 
getReq() {
    var 
req false;
    if (
window.XMLHttpRequest) { // Mozilla, Safari,...
       
req = new XMLHttpRequest();
       if (
req.overrideMimeType) {
           
// set type accordingly to anticipated content type
          //req.overrideMimeType('text/xml');
          
req.overrideMimeType('text/html');
       }
    } else if (
window.ActiveXObject) { // IE
       
try {
          
req = new ActiveXObject("Msxml2.XMLHTTP");
       } catch (
e) {
          try {
             
req = new ActiveXObject("Microsoft.XMLHTTP");
          } catch (
e) {}
       }
    }
    if (!
req) {
       
alert('Cannot create XMLHTTP instance');
       return 
false;
    }
    return 
req;
  }
  function 
refreshBox() {
    var 
req getReq();
    
req.onreadystatechange = function parseResult() {
      
showContent(req);
    }
    
req.open('get','chat.php?dummy=' + new Date().getTime(),true);
    
req.send(null);
  }
  function 
makePostRequest(parameter) {
    var 
req getReq();
    
req.onreadystatechange = function parseResult() {
      
showContent(req);
    }
    
req.open('post','chat.php?dummy=' + new Date().getTime(),true);
    
req.setRequestHeader("Content-type""application/x-www-form-urlencoded");
    
req.setRequestHeader("Content-length"parameter.length);
    
req.setRequestHeader("Connection""close");
    
req.send(parameter); //for POST
  
}
  
  function 
showContent(req) { 
    if (
req.readyState == && req.status == 200) {
      var 
contentObj document.getElementById('chatArea');        
      
contentObj.innerHTML req.responseText;
      
contentObj.scrollBottum contentObj.scrollHeight;
    } else  {  
      var 
contentObj document.getElementById('chatArea').innerHTML == 'Error when loading chat area. Please try again.'
    
}
  }
  
  function 
getVar(obj) {
    var 
postStr '';
    
document.forms['form_msg'].msg.disabled true;
    for (
i=0obj.childNodes.lengthi++) {
       if (
obj.childNodes[i].tagName == "INPUT") {
          if (
obj.childNodes[i].type == "text") {
             
postStr += obj.childNodes[i].name "=" encodeURI(obj.childNodes[i].value) + "&";
          }
          if (
obj.childNodes[i].type == "checkbox") {
             if (
obj.childNodes[i].checked) {
                
postStr += obj.childNodes[i].name "=" encodeURI(obj.childNodes[i].value) + "&";
             } else {
                
postStr += obj.childNodes[i].name "=&";
             }
          }
          if (
obj.childNodes[i].type == "radio") {
             if (
obj.childNodes[i].checked) {
                
postStr += obj.childNodes[i].name "=" encodeURI(obj.childNodes[i].value) + "&";
             }
          }
       }   
       if (
obj.childNodes[i].tagName == "SELECT") {
          var 
sel obj.childNodes[i];
          
postStr += sel.name "=" encodeURI(sel.options[sel.selectedIndex].value) + "&";
       }
    }
    
makePostRequest(postStr);
    
document.forms['form_msg'].msg.value '';
    
document.forms['form_msg'].msg.disabled false;
  }
  
  var 
mod_loaded false;
  function 
onload() {
    
refreshBox();    
    
doRefresh();
  }
  
  function 
doRefresh() {    
    
refreshBox();    
    
refreshTimer setTimeout('doRefresh();'800);
    
clearTimeout(refreshTimer);

  }
</script>
 
</head>
<body onload = 'onload()'>
<div style = 'height: 200px; width: 50%; border: 1px dashed #000; overflow: auto;' id = 'chatArea' name = 'chatArea'></div>
  <form action = "javascript:getVar(document.getElementById('form_msg'))" name = 'form_msg' id = 'form_msg' method = 'post'> 
  name:<input type = 'text' name = 'username' id = 'username' value = ''><br />
  msg:<input type = 'text' name = 'msg' id = 'msg' value = ''>
  <input type = 'submit' value = 'submit'>
  </form>
</body>
</html> 
The above is my javascript. I'm doing a chat system, and have no idea where do those leaks come from. Please assist me.

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed