HighDots Forums  

need help understanding some JS code

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss need help understanding some JS code in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
test
 
Posts: n/a

Default need help understanding some JS code - 11-06-2004 , 06:41 PM






I am reading through some JS code for DHTML menus

here is how it begins

ypSlideOutMenu.Registry = []
ypSlideOutMenu.aniLen = 250
ypSlideOutMenu.hideDelay = 1000
ypSlideOutMenu.minCPUResolution = 10

// constructor
function ypSlideOutMenu(id, dir, left, top, width, height)
{
this.ie = document.all ? 1 : 0
this.ns4 = document.layers ? 1 : 0
this.dom = document.getElementById ? 1 : 0

what is the "this.ie", "this.ns4", "this.dom"?
are they some special variables?

the complete code is here:
http://www.blender3d.org/_js/ypSlideOutMenus.js

the web page is
http://www.blender3d.org/

Reply With Quote
  #2  
Old   
RobG
 
Posts: n/a

Default Re: need help understanding some JS code - 11-14-2004 , 06:40 AM






test wrote:
[...]
Quote:
what is the "this.ie", "this.ns4", "this.dom"?
are they some special variables?
[...]

No. They are just some variables that are set to '1' or '0' depending
upon whether the browser the script is running in supports the methods
document.all, document.layers or document.getElementById. They should
probably be set to true or false, but 1 and 0 have the same effect.

The implication is that browsers supporting document.all are "IE",
those that support document.layers are "Netscape 4" and those that
support document.getElementById are DOM compliant.

Of course, some browsers support more than one, but I guess that
doesn't really matter.

Rob.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.