Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2006
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    modifying ypSlideOutMenus

    I need to modify this ypSlideOutMenus javascript so that it doesn't use absolute positioning. I will have maybe 50 menus on a page and finding the top and left value for each menu will be difficult. I am developing a shirt site and each shirt will have a rollover menu that will display colors and keywords for that shirt. www.liquidcotton.com

    Any tips on how to do this or even suggestions of other menus would be awesome!

    James



    Code:
    /*****************************************************
     * ypSlideOutMenu
     * 3/04/2001
     * 
     * a nice little script to create exclusive, slide-out
     * menus for ns4, ns6, mozilla, opera, ie4, ie5 on 
     * mac and win32. I've got no linux or unix to test on but 
     * it should(?) work... 
     *
     * --youngpup--
     *****************************************************/
    
    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
    
    	if (this.ie || this.ns4 || this.dom) {
    		this.id			 = id
    		this.dir		 = dir
    		this.orientation = dir == "left" || dir == "right" ? "h" : "v"
    		this.dirType	 = dir == "right" || dir == "down" ? "-" : "+"
    		this.dim		 = this.orientation == "h" ? width : height
    		this.hideTimer	 = false
    		this.aniTimer	 = false
    		this.open		 = false
    		this.over		 = false
    		this.startTime	 = 0
    
    		// global reference to this object
    		this.gRef = "ypSlideOutMenu_"+id
    		eval(this.gRef+"=this")
    
    		// add this menu object to an internal list of all menus
    		ypSlideOutMenu.Registry[id] = this
    
    		var d = document
    		d.write('<style type="text/css">')
    		d.write('#' + this.id + 'Container { visibility:hidden; ')
    		d.write('left:' + left + 'px; ')
    		d.write('top:' + top + 'px; ')
    		d.write('overflow:hidden; }')
    		d.write('#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; ')
    		d.write('width:' + width + 'px; ')
    		d.write('height:' + height + 'px; ')
    		d.write('clip:rect(0 ' + width + ' ' + height + ' 0); ')
    		d.write('}')
    		d.write('</style>')
    
    		this.load()
    	}
    }
    
    ypSlideOutMenu.prototype.load = function() {
    	var d = document
    	var lyrId1 = this.id + "Container"
    	var lyrId2 = this.id + "Content"
    	var obj1 = this.dom ? d.getElementById(lyrId1) : this.ie ? d.all[lyrId1] : d.layers[lyrId1]
    	if (obj1) var obj2 = this.ns4 ? obj1.layers[lyrId2] : this.ie ? d.all[lyrId2] : d.getElementById(lyrId2)
    	var temp
    
    	if (!obj1 || !obj2) window.setTimeout(this.gRef + ".load()", 100)
    	else {
    		this.container	= obj1
    		this.menu		= obj2
    		this.style		= this.ns4 ? this.menu : this.menu.style
    		this.homePos	= eval("0" + this.dirType + this.dim)
    		this.outPos		= 0
    		this.accelConst	= (this.outPos - this.homePos) / ypSlideOutMenu.aniLen / ypSlideOutMenu.aniLen 
    
    		// set event handlers.
    		if (this.ns4) this.menu.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
    		this.menu.onmouseover = new Function("ypSlideOutMenu.showMenu('" + this.id + "')")
    		this.menu.onmouseout = new Function("ypSlideOutMenu.hideMenu('" + this.id + "')")
    
    		//set initial state
    		this.endSlide()
    	}
    }
    	
    ypSlideOutMenu.showMenu = function(id)
    {
    	var reg = ypSlideOutMenu.Registry
    	var obj = ypSlideOutMenu.Registry[id]
    	
    	if (obj.container) {
    		obj.over = true
    
    		// close other menus.
    		for (menu in reg) if (id != menu) ypSlideOutMenu.hide(menu)
    
    		// if this menu is scheduled to close, cancel it.
    		if (obj.hideTimer) { reg[id].hideTimer = window.clearTimeout(reg[id].hideTimer) }
    
    		// if this menu is closed, open it.
    		if (!obj.open && !obj.aniTimer) reg[id].startSlide(true)
    	}
    }
    
    ypSlideOutMenu.hideMenu = function(id)
    {
    	// schedules the menu to close after <hideDelay> ms, which
    	// gives the user time to cancel the action if they accidentally moused out
    	var obj = ypSlideOutMenu.Registry[id]
    	if (obj.container) {
    		if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
    		obj.hideTimer = window.setTimeout("ypSlideOutMenu.hide('" + id + "')", ypSlideOutMenu.hideDelay);
    	}
    }
    
    ypSlideOutMenu.hideAll = function()
    {
            var reg = ypSlideOutMenu.Registry
            for (menu in reg) {
                    ypSlideOutMenu.hide(menu);
                    if (menu.hideTimer) window.clearTimeout(menu.hideTimer);
            }
    }
    
    ypSlideOutMenu.hide = function(id)
    {
    	var obj = ypSlideOutMenu.Registry[id]
    	obj.over = false
    
    	if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
    	
    	// flag that this scheduled event has occured.
    	obj.hideTimer = 0
    
    	// if this menu is open, close it.
    	if (obj.open && !obj.aniTimer) obj.startSlide(false)
    }
    
    ypSlideOutMenu.prototype.startSlide = function(open) {
    	this[open ? "onactivate" : "ondeactivate"]()
    	this.open = open
    	if (open) this.setVisibility(true)
    	this.startTime = (new Date()).getTime()	
    	this.aniTimer = window.setInterval(this.gRef + ".slide()", ypSlideOutMenu.minCPUResolution)
    }
    
    ypSlideOutMenu.prototype.slide = function() {
    	var elapsed = (new Date()).getTime() - this.startTime
    	if (elapsed > ypSlideOutMenu.aniLen) this.endSlide()
    	else {
    		var d = Math.round(Math.pow(ypSlideOutMenu.aniLen-elapsed, 2) * this.accelConst)
    		if (this.open && this.dirType == "-")		d = -d
    		else if (this.open && this.dirType == "+")	d = -d
    		else if (!this.open && this.dirType == "-")	d = -this.dim + d
    		else										d = this.dim + d
    
    		this.moveTo(d)
    	}
    }
    
    ypSlideOutMenu.prototype.endSlide = function() {
    	this.aniTimer = window.clearTimeout(this.aniTimer)
    	this.moveTo(this.open ? this.outPos : this.homePos)
    	if (!this.open) this.setVisibility(false)
    	if ((this.open && !this.over) || (!this.open && this.over)) {
    		this.startSlide(this.over)
    	}
    }
    
    ypSlideOutMenu.prototype.setVisibility = function(bShow) { 
    	var s = this.ns4 ? this.container : this.container.style
    	s.visibility = bShow ? "visible" : "hidden"
    }
    ypSlideOutMenu.prototype.moveTo = function(p) { 
    	this.style[this.orientation == "h" ? "left" : "top"] = this.ns4 ? p : p + "px"
    }
    ypSlideOutMenu.prototype.getPos = function(c) {
    	return parseInt(this.style[c])
    }
    
    // events
    ypSlideOutMenu.prototype.onactivate		= function() { }
    ypSlideOutMenu.prototype.ondeactivate	= function() { }

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,519
    Thanks
    3
    Thanked 507 Times in 494 Posts
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
    
    <html>
    
    <head>
      <title></title>
    <script language="JavaScript" type="text/javascript">
    <!--
    // Change Width/Height Part 1 (31-July-2006)
    // by Vic Phillips - http://www.vicsjavascripts.org.uk
    
    
    // An elements width or height may be progressively changed or toggled
    // to a new specified dimension at specified increments.
    // Options allow
    // the change to be linear or progressive,
    // the change to be Up, Down, Left, Right or Centered,
    // the element removed (display:none;) or  hidden (visibility:hidden) when at the minimum dimension.
    // the z-index changed when extending or retracting.
    //
    // Multiple effects may be defined for as many elements as required.
    //
    // Optional Code allows the effects of a group of elements to be controlled
    // for single or multiple level applications such as menus,
    // and persitance(a Cookie) allows the last state to be restored when revisiting.
    
    
    // ***** Application Notes for Part 1 and Part 2
    
    
    // ***** Initialising the Effect
    //
    // The each effect would normally be initialised by a  <BODY> or window onload event call to function 'zxcWHSlide'.
    // There may be multiple calls to define a number of effects to different objects.
    // e.g.
    // zxcWHSlide('Tst1','WP');zxcWHSlide('Tst1','H');
    // where:
    // parameter 0 = the object to apply the effect or the unique ID name of the object. (string)
    // parameter 1 = a character string defining the effect options.                     (string)
    //                'W' = slide width
    //                'H' = slide height ('W' has priority over 'H').
    //                'R' = slide height up for H, slide width left.
    //                     (default, height = expand down, width = expand right).
    //                'C' = position center for width, position middle for height.
    //                'P' = progressive steps.
    //                'V' = visibility='hidden' at minimum width/height.
    //                'D' = display='none' at minimum width/height.
    //                'K' = for persistance(cookies) (see ***** Persistance).
    // parameter 2 = (optional) the number of steps in applying the effect(speed).       (digits, default = 50)
    // parameter 3 = (optional) the minimum width/height.                                (digits, default = 0)
    // parameter 4 = (optional) the maximum width/height.                                (digits, default = the current width/height)
    //
    // Note:
    // The OOP for the effect is identified by a unique character string comprising of
    // the element ID name(parameter 0) and the option string(parameter 0).
    // There may be as many effects as required assigned to an element.
    //
    
    
    // ***** Executing the Effect
    //
    // Once initialised the effect can be called by an event call to 'zxcWHExecute'
    // e.g.
    // zxcWHExecute('Tst1WP');
    // where:
    // parameter 0 = the effect (the unique character string comprising of the element ID name and the option string). (string)
    // parameter 1 = (optional) if null, the default is to toggle expand/retract the width or height.
    //                digit > 0 expand the width or height.                                                            (digits +ve)
    //                digit < 0 reduce the width or height.                                                            (digits -ve)
    // parameter 2 = (optional) the zIndex of the object.                                                              (digits)
    //                if null, the default is variable 'zxcZIndex' + parameter 1
    //
    //
    
    // ***** Tables
    //
    // Changing the width/height of table <TR> elements
    // requires that the content of each <TD> is nested in a <DIV>
    // with a style, 'position:relative;' and 'overflow:hidden;'
    // Each <TD> must also be assigned a class name which includes the characters 'zxcWH'
    // e.g.
    //  <table cellpadding="0" cellspacing="0" border="1">
    //   <tr>
    //     <td width=100 onclick="zxcWHExecute('R1HPD');" >Show</td>
    //   </tr>
    //   <tr id="R1" style="display:none;" >
    //     <td>
    //      <div class="zxcWH" style="position:relative;overflow:hidden;height:100%;" >
    //       Show Content  Show Content Show Content Show Content Show Content Show Content
    //      </div>
    //     </td>
    //   </tr>
    //  </table>
    //
    
    
    // ***** Controlling a Group of Element Effects
    // Requires Optional Part 2 Code
    //
    // A group of element effect may be controlled by an event call to function 'zxcWHGroup'.
    // This may control single level requirements or multi level requirements such as menue.
    //
    
    // *** Single Level Requirements
    //
    // Each element effect in the group must be initialised, see ***** Initialising the Effect
    // The element to expand or contract the effect must be assigned an event call to function 'zxcWHGroup'
    // e.g.
    //  <div onclick="zxcWHGroup('Tst4HPV','Grp2');" style="width:100px;height:30px;background-color:red;">Link</div>
    //  <div id="Tst4" style="visibility:hidden;width:200px;height:0px;border:solid black 1px;background-color:red;" ></div>
    //  <div onclick="zxcWHGroup('Tst5HPV','Grp2');" style="width:100px;height:30px;background-color:blue;">Link</div>
    //  <div id="Tst5" style="position:relative;visibility:hidden;width:200px;height:0px;border:solid black 1px;background-color:blue;" ></div>
    // where:
    // parameter 0 = the effect (the unique character string comprising of the element ID name and the option string). (string)
    // parameter 1 = a unique string to identify the group.                                                            (string)
    // parameter 2 = null or omit.                                                                                     (null or omit)
    //
    
    // *** Multi Level Requirements
    //
    // Each element effect in the group must be initialised, see ***** Initialising the Effect
    // The element to expand or contract the effect must be assigned an event call to function 'zxcWHGroup'
    // The event type may be 'onmouseover' or 'onclick' but must be the same for all group event calls.
    // The Levels are considered to be from 0 to the maximum number of levels.
    // The top level element is considered to be level O, lower levels are assigned by the to function 'zxcWHGroup'
    // e.g.
    //  <div onmouseover="zxcWHGroup('Tst1HPD','Grp1',1);" style="width:100px;height:30px;background-color:red;">Level 0</div>
    //   <div id="Tst1" onmouseover="zxcWHGroup('Tst1-2HPD','Grp1',2);"  style="visibility:hidden;width:200px;height:0px;border:solid black 1px;background-color:red;" >Level 1</div>
    //    <div id="Tst1-2" onmouseover="zxcWHGroup(null,'Grp1',3);"  style="visibility:hidden;width:200px;height:0px;border:solid black 1px;background-color:green;" >Level 2</div>
    //  <div onmouseover="zxcWHGroup('Tst2HPD','Grp1',1);" style="width:100px;height:30px;background-color:blue;">Level 0</div>
    //   <div id="Tst2"  style="position:relative;visibility:hidden;width:200px;height:0px;border:solid black 1px;background-color:blue;" >Level 1</div>
    // where:
    // parameter 0 = the effect (the unique character string comprising of the element ID name and the option string).
    //               if there is no effect(for the highest level) use 'null'                                           (string or null)
    // parameter 1 = a unique string to identify the group.                                                            (string)
    // parameter 2 = the level to be assigned to the effect specified in parameter 0.                                  (digits)
    //
    // Extended element will retract
    // when activated by onmouseover:
    // onmouseout of an element if a mouseover event does not occur within 500 milliSeconds.
    // when activated by onclick:
    // an onclick event outside of an element if an element onclick event does not occur within 500 milliSeconds.
    //
    
    
    // ***** Persistance (Cookies)
    // Requires Optional Part 3 Code
    //
    // A cookie can remember the last width/height state of an single element or group of elements.
    // Elements within a group of elements should not have an individual cookie.
    //
    // **** Single Element Persistance
    //
    // The element initalisation call parameter 1 must include the character 'K'
    // The cookie is evaluated by a <BODY> or window onload event call to function 'zxcWHSingleCookie'
    // e.g.
    // <BODY onload="zxcWHSlide('Tst5','HPD',0,100,50);zxcWHSingleCookie('Tst5HPD');" >
    // where:
    // parameter 0 = the effect (the unique character string comprising of the element ID name and the option string). (string)
    // Note, this call must be after the element initialisation call to function 'zxcWHSlide'.
    //
    // **** Element Group Persistance
    //
    // The width/height states of all elements in a group may be stored in a cookie
    // The group name of the group must include the character string 'Cookie' ie 'Cookie3'.
    // The cookie is evaluated by a <BODY> or window onload event call to function 'zxcWHGroupCookie'
    // e.g.
    //  zxcWHGroupCookie('Cookie3');
    // where:
    // parameter 0 = the group name (string).
    // Note, this call must be after all elements in the group have been initialisated by a call to function 'zxcWHSlide'.
    //
    
    
    // ***** General
    //
    // All variable, function etc. names are prefixed with 'zxc' to minimise conflicts with other JavaScripts
    // These characters are easily changed to characters of choice using global find and replace.
    
    // The functional code Part 1 (about 3.5K), Part 2 (about 3K) and  Part 3 (about 1.75K) are best as an external JavaScript
    
    // Tested with IE6 and Mozilla FireFox
    
    
    // ***** Customising Variables
    
    var zxcZIndex=10;  // The default Z-INDEX of 'Slide' Objects if not assigned in the object INLINE code. (digits)
    var zxcWHDays=1/24/60; // The number of days to retain Cookies (persistance).                               (digits)
    
    
    
    // ***** Functional Code NO NEED to Change
    
    function zxcWHExecute(zxcid,zxcd,zxcz){
     var zxcoop=window[zxcid];
     if (!zxcoop){ return; }
     clearTimeout(zxcoop.to);
     zxcoop.obj.style.display='';
     zxcoop.obj.style.visibility='visible';
     zxcoop.d=zxcd||zxcoop.d;
     zxcoop.obj.style.zIndex=zxcz||zxcoop.zindex+zxcoop.d;
     if (zxcoop.cookie&&window['zxcWHSetCookie']){ zxcWHSetCookie(zxcid,zxcoop.d+','+(zxcz||zxcZIndex)); }
     zxcoop.cngwh();
    }
    
    function zxcWHSlide(zxcobj,zxcopt,zxcmin,zxcmax,zxcstps){
     if (typeof(zxcobj)=='string'){ zxcobj=document.getElementById(zxcobj); }
     if (!zxcobj){ return; }
     if (window[zxcobj.id+zxcopt]){ return; }
     if (zxcobj.tagName!='TR'){ zxcobj.style.overflow='hidden'; }
     window[zxcobj.id+zxcopt]=new zxcOOPWH(zxcobj,zxcopt,zxcmin,zxcmax,zxcstps);
    }
    
    function zxcOOPWH(zxcobj,zxcopt,zxcmin,zxcmax,zxcstps){
     this.obj=zxcobj;
     var zxcels=zxcobj.getElementsByTagName('DIV');
     for (var zxc0=0;zxc0<zxcels.length;zxc0++){
      var zxccn=zxcels[zxc0].className; if (zxccn.match('zxcWH')){ if (!this.ary){ this.ary=[]; }; this.ary.push(zxcels[zxc0]); }
     }
     this.opt=zxcopt;
     this.wh=this.opt.match('W')?['width','left']:['height','top'];
     this.cookie=this.opt.match('K')?true:false;
     this.zindex=parseInt(zxcobj.style.zIndex)||zxcZIndex;
     this.srt=true;
     this.d=1;
     this.cnt=0;
     this.stps=zxcstps||50;
     this.hide=[Math.min(zxcmin,zxcmax),Math.max(zxcmin,zxcmax)];
     this.steps=zxcSteps(this.opt.match('P'),this.stps,zxcmin,zxcmax)
     this.to=null;
     this.dly=document.all?20:10;
     this.ref='zxcwh'+zxcobj.id+zxcopt;
     window[this.ref]=this;
     this.wh[2]=this.opt.match('H')?zxcobj.offsetTop:zxcobj.offsetLeft;
    }
    
    zxcOOPWH.prototype.cngwh=function(){
     if ((this.d>0&&this.cnt+this.d<this.stps)||(this.d<0&&this.cnt+this.d>0)){
      this.obj.style[this.wh[0]]=(this.steps[this.cnt+=this.d])+'px';
      if (this.opt.match('R')){ this.obj.style[this.wh[1]]=(this.wh[2]-this.steps[this.cnt])+'px';
     }
      if (this.opt.match('C')){ this.obj.style[this.wh[1]]=(this.wh[2]-(this.steps[this.cnt])/2)+'px'; }
      if (this.ary){ this.cngwhary(); }
      this.setTimeOut('cngwh();',this.dly);
     }
     else {
      if (this.d<0){ this.obj.style[this.wh[0]]=this.steps[0]+'px'; }
      if (this.d>0){ this.obj.style[this.wh[0]]=this.steps[this.stps-1]+'px'; }
      if (this.ary){ this.cngwhary(); }
      if (parseInt(this.obj.style[this.wh[0]])==this.hide[0]){
       if (this.opt.match('D')){ this.obj.style.display='none'; }
       if (this.opt.match('V')){ this.obj.style[this.wh[0]]=(Math.max(parseInt(this.obj.style[this.wh[0]]),1))+'px';  this.obj.style.visibility='hidden'; }
      }
      this.d=-this.d;
     }
    }
    
    zxcOOPWH.prototype.cngwhary=function(){
     for (var zxc0=0;zxc0<this.ary.length;zxc0++){
      this.ary[zxc0].style[this.wh[0]]=this.obj.style[this.wh[0]];
     }
    }
    
    zxcOOPWH.prototype.setTimeOut=function(zxcf,zxcd){
     this.to=setTimeout('window.'+this.ref+'.'+zxcf,zxcd);
    }
    
    function zxcSteps(zxcmd,zxcstps,zxcsrt,zxcfin,zxcrev){
     var zxcsary=[];
     if (zxcmd){
      for (zxc0=0;zxc0<90;zxc0+=90/(zxcstps-1)){ zxcsary.push(Math.floor((zxcfin-zxcsrt)+(zxcfin-zxcsrt)*Math.sin((zxc0+(zxcrev?270:360))*Math.PI/180))); }
      for (zxc1=1;zxc1<zxcsary.length;zxc1++){ zxcsary[zxc1]=zxcsary[zxc1]-zxcsary[0]+zxcsrt; }
     }
     else { for (zxc1=0;zxc1<zxcstps-1;zxc1++){ zxcsary[zxc1]=Math.floor(Math.abs((zxcsrt-zxcfin)/(zxcstps-1))*zxc1+Math.min(zxcsrt,zxcfin)); } }
     if (zxcmd){ zxcsary[0]=zxcsrt; zxcsary.push(zxcfin); }
     else if (zxcsrt>zxcfin){ zxcsary.push(zxcsrt); zxcsary=zxcsary.reverse();  }
     else { zxcsary.push(zxcfin); }
     return zxcsary;
    }
    
    
    //-->
    </script>
    
    
    <script language="JavaScript" type="text/javascript">
    <!--
    // Change Width/Height Part 2 (31-July-2006)
    // by Vic Phillips - http://www.vicsjavascripts.org.uk
    
    // For Group Applications
    
    // Requires Change Width/Height Part 1
    // which contains the Application Notes.
    
    
    // ***** Functional Code NO NEED to Change
    
    var zxcWHTO,zxcWHGAry,zxcWHLst;
    
    function zxcWHGroup(zxcid,zxcgrp,zxcl){
     var zxcevt=window.event||arguments.callee.caller.arguments[0];
     var zxceobj=zxcWHEventObj(zxcevt);
     if (zxcid==zxcWHLst&&zxcl){ return; }
     if (!window[zxcgrp]){ window[zxcgrp]=[]; }
     zxcWHLst=zxcid;
     var zxcary=window[zxcgrp];
     zxcWHGAry=zxcary;
     if (!zxcl){ zxcWHGAry=null; }
     var zxcoop=window[zxcid];
     if (!zxcoop){ return; }
     if (zxcoop.srt&&zxcl){
      if (!zxcoop.level){ zxcary.push(zxcid); }
      if (zxcevt.type=='mouseover'){ zxcAddEvt(zxcoop.obj,'zxcWHNoHide','mouseover'); zxcAddEvt(zxcoop.obj,'zxcWHHide','mouseout'); zxcAddEvt(zxceobj,'zxcWHHide','mouseout'); }
      zxcAddEvt(zxcoop.obj,'zxcWHNoHide','click');
      zxcoop.obj.set=true; zxceobj.set=true; zxcoop.srt=false;
     }
     clearTimeout(zxcWHTO);
     zxcl=zxcl||1;
     zxcoop.level=zxcl;
     zxcckary=[];
     zxcckary.push([zxcid,zxcoop.d,zxcl,zxcoop.zindex]);
     for (var zxc0=0;zxc0<zxcary.length;zxc0++){ if (zxcary[zxc0]!=zxcid&&window[zxcary[zxc0]].level>=zxcl){ zxcWHExecute(zxcary[zxc0],-1); } }
     if (zxcgrp.match('Cookie')&&window['zxcWHSetGrpCookie']){ zxcWHSetGrpCookie(zxcgrp,zxcid,zxcoop,zxcl,zxcary); }
     zxcWHExecute(zxcid);
    }
    
    function zxcWHNoHide(){
     setTimeout('clearTimeout(zxcWHTO);',10);
    }
    
    function zxcWHHide(zxce){
     if (!zxcWHGAry||!zxcWHCkEventObj(zxce)){ return; }
     zxcWHTO=setTimeout(function(){ for (var zxc0=0;zxc0<zxcWHGAry.length;zxc0++){ zxcWHExecute(zxcWHGAry[zxc0],-1); } zxcWHLst=null; },200);
    }
    
    function zxcWHEventObj(zxce){
     if (!zxce) var zxce=window.event;
     zxce.cancelBubble=true;
     if (zxce.stopPropagation) zxce.stopPropagation();
     if (zxce.target) zxceobj=zxce.target;
     else if (zxce.srcElement) zxceobj=zxce.srcElement;
     if (zxceobj.nodeType==3) zxceobj=zxceobj.parentNode;
     return zxceobj;
    }
    
    function zxcWHCkEventObj(zxce){
     var zxceobj;
     if (!zxce) var zxce=window.event;
     zxce.cancelBubble=true;
     if (zxce.stopPropagation) zxce.stopPropagation();
     if (zxce.type=='mouseout'){ zxceobj=(zxce.relatedTarget)?zxceobj=zxce.relatedTarget:zxceobj=zxce.toElement;  }
     else { zxceobj=zxcWHEventObj(zxce); }
     while (zxceobj.parentNode){
      if (zxceobj.set){ return false; }
      zxceobj=zxceobj.parentNode;
     }
     return zxceobj;
    }
    
    function zxcEventAdd(zxco,zxct,zxcf) {
     if ( zxco.addEventListener ){ zxco.addEventListener(zxct, function(e){ zxco[zxcf](e);}, false); }
     else if ( zxco.attachEvent ){ zxco.attachEvent('on'+zxct,function(e){ zxco[zxcf](e); }); }
     else {
      var zxcPrev=zxco["on" + zxct];
      if (zxcPrev){ zxco['on'+zxct]=function(e){ zxcPrev(e); zxco[zxcf](e); }; }
      else { zxco['on'+zxct]=zxco[zxcf]; }
     }
    }
    
    var zxcEvt=0;
    
    function zxcAddEvt(zxco,zxcfun,zxcevt){
     if (!zxco){ return; }
     if (zxco['zxc'+zxcfun+zxcevt]){ return; }
     zxco['zxcaddEvt'+zxcEvt]=window[zxcfun];
     zxco['zxc'+zxcfun+zxcevt]=true;
     zxcEventAdd(zxco,zxcevt,'zxcaddEvt'+zxcEvt);
     zxcEvt++;
    }
    
    zxcAddEvt(document,'zxcWHHide','click');
    
    function Init(){
     zxcWHSlide('Tst1','HPD',0,100,50);
     zxcWHSlide('Tst2','HPD',0,100,50);
    }
    
    //-->
    </script>
    </head>
    
    <body onload="Init();" >
    
    <div style="position:relative;width:100px;" >
    <div onmouseover="zxcWHGroup('Tst1HPD','Grp1',1);" style="width:100px;height:30px;background-color:red;">Level 0</div>
    <div id="Tst1" style="position:absolute;visibility:hidden;left:20px;top:30px;width:200px;height:0px;border:solid black 1px;background-color:red;" >Level 1</div>
    </div>
    <br>
    <br>
    <center><br>
    <div style="position:relative;width:100px;" >
    <div onmouseover="zxcWHGroup('Tst2HPD','Grp1',1);" style="width:100px;height:30px;background-color:red;">Level 0</div>
    <div id="Tst2" style="position:absolute;visibility:hidden;left:20px;top:30px;width:200px;height:0px;border:solid black 1px;background-color:red;" >Level 1</div>
    </div>
    
    </center>
    </body>
    
    </html>
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •