Javascript "object doesn't support this property or method" 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.code+=(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:-
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=t his.format;
this.root.format=this.format;
this.root.sub=def.sub;eval("window."+this.id+"=thi s");
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,thi s.format.top,this.format.width,this.format.height, this.getp(this.root,"back_bgcolor",0),0,1,this.get p(this.root,"back_class",0),this.code,0)+this.wm_c ode());
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=l vl;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.code+=(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));
}
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%4 4%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.l evel_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||'javas cript:'+(n.sub?hr:'void(0)'))+'" onclick="if(this.blur)this.blur();'+(n.sub&&n.url? 'Toggle(\''+this.name+'\',\''+n.id.substr(this.nam e.length+3)+'\',1)':'')+'"'+(targ?' target=':'')+'target=Main>'+n.html+'</a>'+'</td>';
s+="</tr></table>";
return s;
};
Last edited by UnrealEd; 01-21-11 at 01:40 PM .
Reason: fixed [code] tags