469,602 Members | 1,826 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

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=(node.obj.draw(0,0,this.getp(node,"widt h","100%"),0,this.getp(node,"bgcolor",0),0,(100 0-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:-

Expand|Select|Wrap|Line Numbers
  1. bw=new Browser();
  2. function SoftDrawerTree(name,def){
  3.     this.def=def;this.format=def.format;this.name=name;this.num=0;this.anim_ref=0;this.id='SDTree'+name;
  4.     this.nodes=[];this.root={id:name+"_i"};this.root.level_format=this.format;
  5.     this.root.format=this.format;
  6.     this.root.sub=def.sub;eval("window."+this.id+"=this");
  7.     if (!bw) bw=new Browser();
  8.     this.init=function(){
  9.         this.code='';
  10.         this.back=new DHTMLObject(this.name+'_back');
  11.         this._init(null,this.root,-1,0);
  12.         if (!this.format.no_images) {var f=this.format;pldImg([f.e_image,f.c_image])};
  13.         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());
  14.         this.back.init();if (this.format.dont_resize_back)this.back.show();
  15.     };
  16.     this._init=function(parent,node,lvl,num){
  17.         if(!node) return; node.parent=parent; node.id=node.id||node.parent.id+"_"+num;node.lvl=lvl;node.ind=(this.num++)-1;
  18.         if(node!=this.root){
  19.             this.nodes[node.id]=node;var s=this.init_item(node);
  20.             node.obj=new DHTMLObject(node.id);
  21.             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));
  22.         }
  23.         if(node.sub) for(var i=0;i<node.sub.length;i++) this._init(node,node.sub[i], lvl+1,i);
  24.     };
  25.     this.wm_code=function(){
  26.     this.wm=new DHTMLObject(this.name+'_wm');
  27.         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>'));
  28.     };
  29.     this.getp=function(n,name,def,nf){return this.format[name]||def};
  30.     this.indent_code=function(n){
  31.         var indent=this.getp(n,"indent",parseInt(this.format.level_indent||16)*n.lvl-this.getp(n,"padding",0))||0;
  32.         return n.lvl&&indent?'<td><img src="'+this.format.b_image+'" width="'+indent+'" height="1"></td>':'';
  33.     };
  34.     this.init_item=function(n){
  35.         var tc=this.getp(n,"table_class",0);
  36.         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>';
  37.         s+=this.indent_code(n);
  38.         var img=this.getp(n,(n.sub?n.exp?"e":"c":"i")+"_image",this.format.b_image);
  39.         var sz=this.getp(n,"img_size",[30,15]);
  40.         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>':'';
  41.         var bgc=this.getp(n,"item_bgcolor",0);bgc=bgc?' bgcolor="'+bgc+'"':' ';
  42.         var targ=n.target||this.format.target||0;
  43.         tc=this.getp(n,"item_class",0);var lc=this.getp(n,"link_class",0);
  44.         var hr='Toggle(\''+this.name+'\',\''+n.id.substr(this.name.length+3)+'\',1)';
  45.         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>';
  46.         s+="</tr></table>";
  47.         return s;
  48.     };
Attached Files
File Type: txt Javascript.txt (3.4 KB, 515 views)
Jan 21 '11 #1
2 6914
Dormilich
8,652 Expert Mod 8TB
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)
Jan 22 '11 #2
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=(node.obj.draw(0,0,this.getp(node,"widt h","100%"),0,this.getp(node,"bgcolor",0),0,(100 0-this.num),this.getp(node,"div_class",0),s));
}

Please kindly advise

Thank you very much in advance
Jan 24 '11 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by guiromero | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.