Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question IE crashes with Document.CreateElement("TR")

    Well in the script in this code if I do not rem out the line in red than IE won't crash but of course I than don't have a visible table either. The code is way too long to put it here so I put the first part and you may find the rest if you need to view it at http://web.tampabay.rr.com/malaac/javacode.htm

    Code:
    var browser;
    var ctrldown = false, shiftdown = false;
    var resizing = false, resizeTimeout = null;
    var tdl = 0, tul = 0, stimer = null;
    var ELE_TABLE = document.createElement("TABLE");
    var ELE_TBODY = document.createElement("TBODY");
    var ELE_DIV = document.createElement("DIV");
    var ELE_SPAN = document.createElement("SPAN");
    var ELE_COLGROUP = document.createElement("COLGROUP");
    var ELE_COL = document.createElement("COL");
    var ELE_TD = document.createElement("TD");
    var ELE_TR = document.createElement("TR");
    var version = "0.300";
    
     
    
    function init(){
    
       if(arguments.callee.done){
    
          return;
    
       }
    
       arguments.callee.done = true;
    
       if(_timer){
    
          clearInterval(_timer);
    
       }
    
       log("WebUI started.");
    
       browser = new BrowserDetect();
    
       if((browser.isIF && ( ! browser.isIE7x || ! browser.isIE7up))){
    
          $("msg").innerHTML = "The WebUI<sup>BETA</sup> does not support your browser.";
    
          return;
    
       }
    
       document.title = "\xb5Torrent WebUI v" + version;
    
       Key.onKeyDown = keyDown;
    
       window.onresize = function(e){
    
          if(browser.isIE && (resizing == false)){
    
             if(resizeTimeout != null){
    
                window.clearTimeout(resizeTimeout);
    
             }
    
             resizeTimeout = window.setTimeout("resizeUI()", 500);
    
          }
    
          else{
    
             resizeUI();
    
          }
    
       }
    
       ;
    
       document.onmouseup = function(e){
    
          if( ! e){
    
             e = window.event;
    
          }
    
          mouse.button = e.button;
    
          if(e.button == 2){
    
          }
    
          else{
    
             window.setTimeout("utWebUI.hideMenu()", 50);
    
          }
    
       }
    
       ;
    
       if(browser.isIE && ! browser.isIE7x){
    
          $("List").style.width = "99%";
    
       }
    
       utWebUI.init();
    
       var o = $("stg_c");
    
       o.innerHTML = stgHtml;
    
       utWebUI.getSettings(false);
    
       utWebUI.config();
    
       var _4 = new Array();
    
       var _5 = [{
    
          "text" : "Name", "width" : "200px", "type" : TYPE_STRING
    
       }
    
       , {
    
          "text" : "Size", "width" : "60px", "type" : TYPE_NUMBER
    
       }
    
       , {
    
          "text" : "Done", "width" : "80px", "type" : TYPE_NUMBER
    
       }
    
       , {
    
          "text" : "Downloaded", "width" : "100px", "type" : TYPE_NUMBER
    
       }
    
       , {
    
          "text" : "Uploaded", "width" : "80px", "type" : TYPE_NUMBER
    
       }
    
       , {
    
          "text" : "Ratio", "width" : "60px", "type" : TYPE_NUMBER
    
       }
    
       , {
    
          "text" : "DL", "width" : "60px", "type" : TYPE_NUMBER
    
       }
    
       , {
    
          "text" : "UL", "width" : "60px", "type" : TYPE_NUMBER
    
       }
    
       , {
    
          "text" : "ETA", "width" : "60px", "type" : TYPE_NUMBER
    
       }
    
       , {
    
          "text" : "Label", "width" : "60px", "type" : TYPE_STRING
    
       }
    
       , {
    
          "text" : "Peers", "width" : "60px", "type" : TYPE_NUMBER
    
       }
    
       , {
    
          "text" : "Seeds", "width" : "60px", "type" : TYPE_NUMBER
    
       }
    
       , {
    
          "text" : "Avail.", "width" : "60px", "type" : TYPE_NUMBER
    
       }
    
       ];

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    I don't think it crashes due to that line. Rather it crashes because you uses DOM methods combined with non-standard innerHTML method. Use only DOM to create elements and text.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New to the CF scene
    Join Date
    Sep 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is it possible for you to show me an example in this code on how to do this? I haven't messed around alot with javascript and DOM is foreign to me. Someone else wrote this than decided that because he couldn't do proper coding he would just remove support for IE completely.

    Most of my programming experience is in Delphi so I know a bit about programming but DOM I haven't touched. If I saw an example of what you mean by changing even a small piece of code I could probably understand or study that section and make the change.

    Thanks


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •