Explanation of code...

by Felipe Deglado <felipe_delgado(at)yahoo.com>

 Date:  Thu, 20 Apr 2000 16:45:35 -0700 (PDT)
 To:  hwg-languages(at)hwg.org
  todo: View Thread, Original
I use Dreamweaver 3.0 and it has a behavior that is
called Set Text of Layer (which is obviously done by
the innerHTML property of the DOM) to, uh, change the
text of a layer.  Anyway, the program generates too
much code that i don't understand and think is
unnecessary.

I'm going to post it here and I would like that please
someone would explain what each part of the script
does so that later I can clean it up so that it won't
be a whole mess of script.  Here goes:

function MM_findObj(n, d) { //v3.0
  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]; 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;
}

function MM_setTextOfLayer(objName,x,newText) { //v3.0
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (navigator.appName=='Netscape')
{document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}

I have no idea what it uses the first function for.  I
could make another script that does what I want, but I
guess I'm too lazy and kind of scared if it isn't user
friendly.

Thanks in advanced.


Felipe Delgado
philippe_d(at)usa.net / felipe_delgado(at)yahoo.com
http://neophi-techzone.tripod.com

__________________________________________________
Do You Yahoo!?
Send online invitations with Yahoo! Invites.
http://invites.yahoo.com

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA