...

View Full Version : IE crashes with Document.CreateElement("TR")



molitar
09-04-2006, 08:01 AM
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


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

}

];

Kor
09-04-2006, 11:44 AM
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.

molitar
09-04-2006, 04:21 PM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum