Dreamweaver Patch

 

One of the major annoyances with wysiwyg editors is that the JavaScript they generate is not Netscape 6 compatible. I patched a Dreamweaver 3 function so that it also works in Netscape 6.

As far as I know, DW4 scripts already work in Netscape 6.

When you make a page containing DHTML (for instance, a dhtml nav bar) in Dreamweaver 3, do what you always do and make the page working in Netscape 4 and Explorer 5. Then, when you're otherwise ready, open the source of the page, find the function MM_findObj and replace it by the patched function:

function MM_findObj(n, d) { //v3.ppk
   var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length)
   {d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
   if(!(x=d[n])&&d.all) x=d.all[n]; if(!(x=d[n])&&d.getElementById) x=d.getElementById(n);
   for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
   return x;}

I retained DW's badly spaced code. Careful readers will note that the only change is that I added

if(!(x=d[n])&&d.getElementById) x=d.getElementById(n);

to the function. This is enough to make your pages work in Netscape 6 (and Opera 5).

Home