How to fix "object doesn't support this property or method" Javascript error on IE 8?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • simeric
    New Member
    • Jan 2011
    • 2

    #1

    How to fix "object doesn't support this property or method" Javascript error on IE 8?

    Hi all experts,

    I've "object doesn't support this property or method" error when running a Javascript on Internet Explorer 8 This is the statement that is having the error:-

    this.nodes=(nod e.obj.draw(0,0, this.getp(node, "width","100%") ,0,this.getp(no de,"bgcolor",0) ,0,(1000-this.num),this. getp(node,"div_ class",0),s));
    }
    Please kindly advise on this error can be fixed please

    Thank you very much

    Below is my full javascript program:-

    Code:
    bw=new Browser();
    function SoftDrawerTree(name,def){
    	this.def=def;this.format=def.format;this.name=name;this.num=0;this.anim_ref=0;this.id='SDTree'+name;
    	this.nodes=[];this.root={id:name+"_i"};this.root.level_format=this.format;
    	this.root.format=this.format;
    	this.root.sub=def.sub;eval("window."+this.id+"=this");
    	if (!bw) bw=new Browser();
    	this.init=function(){
    		this.code='';
    		this.back=new DHTMLObject(this.name+'_back');
    		this._init(null,this.root,-1,0);
    		if (!this.format.no_images) {var f=this.format;pldImg([f.e_image,f.c_image])};
    		document.write(this.back.draw(this.format.left,this.format.top,this.format.width,this.format.height,this.getp(this.root,"back_bgcolor",0),0,1,this.getp(this.root,"back_class",0),this.code,0)+this.wm_code());
    		this.back.init();if (this.format.dont_resize_back)this.back.show();
    	};
    	this._init=function(parent,node,lvl,num){
    		if(!node) return; node.parent=parent; node.id=node.id||node.parent.id+"_"+num;node.lvl=lvl;node.ind=(this.num++)-1;
    		if(node!=this.root){
    			this.nodes[node.id]=node;var s=this.init_item(node);
    			node.obj=new DHTMLObject(node.id);
    			this.nodes=(node.obj.draw(0,0,this.getp(node,"width","100%"),0,this.getp(node,"bgcolor",0),0,(1000-this.num),this.getp(node,"div_class",0),s));
    		}
    		if(node.sub) for(var i=0;i<node.sub.length;i++) this._init(node,node.sub[i], lvl+1,i);
    	};
    	this.wm_code=function(){
    	this.wm=new DHTMLObject(this.name+'_wm');
    		return this.wm.draw(this.format.left,this.format.top+this.format.height+2,this.format.width,12,0,1,2,0,(bw.ns4?'<font face="Verdana, sans-serif" color=silver point-size=6>':'<div style="font-size:1px;color:white;">')+unescape('%53%6F%66%74%44%72%61%77%65%72%20%6A%73%54%72%65%65')+(bw.ns4?'</font>':'</div>'));
    	};
    	this.getp=function(n,name,def,nf){return this.format[name]||def};
    	this.indent_code=function(n){
    		var indent=this.getp(n,"indent",parseInt(this.format.level_indent||16)*n.lvl-this.getp(n,"padding",0))||0;
    		return n.lvl&&indent?'<td><img src="'+this.format.b_image+'" width="'+indent+'" height="1"></td>':'';
    	};
    	this.init_item=function(n){
    		var tc=this.getp(n,"table_class",0);
    		var s='<table width="'+this.getp(n,"width","100%")+'" cellpadding="'+this.getp(n,"padding",0)+'" cellspacing="'+this.getp(n,"spacing",0)+'" border="0"'+(tc?' class="'+tc+'"':'')+'><tr>';
    		s+=this.indent_code(n);
    		var img=this.getp(n,(n.sub?n.exp?"e":"c":"i")+"_image",this.format.b_image);
    		var sz=this.getp(n,"img_size",[30,15]);
    		s+=!this.getp(n,"no_images",0)?'<td>'+(n.sub?'<a onclick="if(this.blur)this.blur()" href="javascript:Toggle(\''+this.name+'\',\''+n.id.substr(this.name.length+3)+'\',0)">':'')+'<img '+(bw.ns4?'name="'+n.id+'_img" ':'')+'id="'+n.id+'_img" src="'+img+'" width="'+sz[0]+'" height="'+sz[1]+'" border="0"/>'+(n.sub?'</a>':'')+'</td>':'';
    		var bgc=this.getp(n,"item_bgcolor",0);bgc=bgc?' bgcolor="'+bgc+'"':' ';
    		var targ=n.target||this.format.target||0;
    		tc=this.getp(n,"item_class",0);var lc=this.getp(n,"link_class",0);
    		var hr='Toggle(\''+this.name+'\',\''+n.id.substr(this.name.length+3)+'\',1)';
    		s+='<td width="100%"'+bgc+(tc?'class="'+tc+'"':'')+'><a '+(lc?'class="'+lc+'"':'')+'href="'+(n.url||'javascript:'+(n.sub?hr:'void(0)'))+'" onclick="if(this.blur)this.blur();'+(n.sub&&n.url?'Toggle(\''+this.name+'\',\''+n.id.substr(this.name.length+3)+'\',1)':'')+'"'+(targ?' target=':'')+'target=Main>'+n.html+'</a>'+'</td>';
    		s+="</tr></table>";
    		return s;
    	};
    Attached Files
    Last edited by Niheel; Jan 21 '11, 10:26 AM. Reason: added code tags moved to the proper topic
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    assuming the error is about node.obj.draw() you need to ensure that node & node.obj are the objects you expect. (I guess FireBug Lite will be necessary for this)

    Comment

    • simeric
      New Member
      • Jan 2011
      • 2

      #3
      Thanks for kind advice, will try.

      Do you've any recommendation how the statement below can be modified for it to work with IE8?


      this.nodes=(nod e.obj.draw(0,0, this.getp(node, "widt h","100%"),0,th is.getp(node,"b gcolor",0),0,(1 00 0-this.num),this. getp(node,"div_ class",0),s));
      }

      Please kindly advise

      Thank you very much in advance

      Comment

      Working...