Abundant Technologies - IT Consulting Experts

 Source Code Library

 Code Details

     
Cross-browser Dynamic HTML Scripts - CoolMenus2


YOUR REGULAR BODY CONTENT GOES IN HERE //Put the code below in a file called coolmenus.js /******************************************************************************* This is the actual script page. You shouldn't really have to edit anything in here. *******************************************************************************/ //Default browsercheck, added to all scripts! function checkBrowser(){ this.ver=navigator.appVersion this.dom=document.getElementById?1:0 this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; this.ie4=(document.all && !this.dom)?1:0; this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; this.ns4=(document.layers && !this.dom)?1:0; this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5) return this } var bw=new checkBrowser() //Ie var var explorerev='' /******************************************************************************** Object constructor and object functions ********************************************************************************/ function makePageCoords(){ this.x=0;this.x2=(bw.ns4 || bw.ns5)?innerWidth:document.body.offsetWidth-20; this.y=0;this.y2=(bw.ns4 || bw.ns5)?innerHeight:document.body.offsetHeight-5; this.x50=this.x2/2; this.y50=this.y2/2; return this; } function makeMenu(parent,obj,nest,type,num,subnum,subsubnum){ nest=(!nest) ? '':'document.'+nest+'.' this.css=bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0; this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+"document.layers." +obj):0; this.height=bw.ns4?this.css.document.height:this.evnt.offsetHeight this.width=bw.ns4?this.css.document.width:this.evnt.offsetWidth this.moveIt=b_moveIt; this.bgChange=b_bgChange; this.clipTo=b_clipTo; this.parent=parent; this.active=0; this.nssubover=0 if(type==0){ this.evnt.onmouseover=new Function("mmover("+num+","+this.parent.name+")"); this.evnt.onmouseout=new Function("mmout("+num+","+this.parent.name+")"); }else if(type==1){ this.clipIn=b_clipIn; this.clipOut=b_clipOut; this.clipy=0 if(bw.ns4 && this.parent.menueventoff=="mouse"){ this.evnt.onmouseout=new Function("setTimeout('if(!"+this.parent.name+"["+num+"].nssubover)"+this.parent.name+".hideactive("+num+");',100)") this.evnt.onmouseover=new Function(this.parent.name+"["+num+"].nssubover=true") } }else if(type==2){ this.evnt.onmouseover=new Function("submmover("+num+","+subnum+","+this.parent.name+")"); this.evnt.onmouseout=new Function("submmout("+num+","+subnum+","+this.parent.name+")"); }else if(type==3){ this.evnt.onmouseover=new Function("subsubmmover("+num+","+subnum+","+subsubnum+","+this.parent.name+")"); this.evnt.onmouseout=new Function("subsubmmout("+num+","+subnum+","+subsubnum+","+this.parent.name+")"); } this.tim=100 this.obj = obj + "Object"; eval(this.obj + "=this") return this } function b_clipTo(t,r,b,l,h){if(bw.ns4){this.css.clip.top=t;this.css.clip.right=r this.css.clip.bottom=b;this.css.clip.left=l; this.clipx=r; }else{this.css.clip="rect("+t+","+r+","+b+","+l+")"; this.clipx=r;; if(h){ if(bw.ie4 || bw.ie5){ this.css.height=b; this.css.width=r}}}} function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x;this.css.top=this.y} function b_bgChange(color){if(bw.dom || bw.ie4) this.css.backgroundColor=color; else if(bw.ns4) this.css.bgColor=color} function b_clipIn(speed){ if(this.clipy>0){ this.clipy-=speed if(this.clipy<0) this.clipy=0 this.clipTo(0,this.clipx,this.clipy,0,1) this.tim=setTimeout(this.obj+".clipIn("+speed+")",10) }else{this.clipy=0; this.clipTo(0,this.clipx,this.clipy,0,1)} } function b_clipOut(speed){ if(this.clipy0){ this.subsuby=0 this[i].sub[j].subs=new makeMenu(this,'div'+this.name+'Sub'+i+'_'+j+'_sub','',1,i,j) this[i].sub[j].subs.moveIt(this[i].subs.x+this.subsubXplacement,this[i].subs.y+this[i].sub[j].y+this.subsubYplacement) this[i].sub[j].sub=new Array() for(a=0;a\n'} str+='
' if(link){ str+=''+text+'
\n' this.mainmenus++; document.write(str) } function makeSub(num,subnum,text,link,total,target){ str="" if(subnum==0) str='
\n' str+='\t
' if(link) str+=''+text+'
\n' if(subnum==total-1){ str+='
\n'; this.submenus[num]=new Array() this.submenus[num]["main"]=total; this.submenus[num]["submenus"]=new Array() } document.write(str) } function makeSubSub(num,subnum,subsubnum,text,link,total,target){ str="" if(subsubnum==0) str='
\n' str+='\t
' if(link) str+=''+text+'
\n' if(subsubnum==total-1){str+='
\n'; this.submenus[num]["submenus"][subnum]=total} document.write(str) } /********************************************************************************************* END Menu script *********************************************************************************************/

Mail To: info@3pc.com