Team:Johns Hopkins/Templates/tpl1
From 2011.igem.org
(Difference between revisions)
Line 25: | Line 25: | ||
addEvent:function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload) var tasktype=(window.addEventListener)? tasktype : "on"+tasktype if (target.addEventListener) target.addEventListener(tasktype, functionref, false) else if (target.attachEvent) target.attachEvent(tasktype, functionref) }, | addEvent:function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload) var tasktype=(window.addEventListener)? tasktype : "on"+tasktype if (target.addEventListener) target.addEventListener(tasktype, functionref, false) else if (target.attachEvent) target.attachEvent(tasktype, functionref) }, | ||
init:function(tabid, dselected){ var menuitems=document.getElementById(tabid).getElementsByTagName("a") this[tabid+"-menuitems"]=menuitems for (var x=0; x<menuitems.length; x++){ if (menuitems[x].getAttribute("rel")){ this[tabid+"-menuitems"][x].hasSubContent=true if (ddtabmenu.disabletablinks) menuitems[x].onclick=function(){return false} if (ddtabmenu.snap2original[0]==true){ var submenu=document.getElementById(menuitems[x].getAttribute("rel")) menuitems[x].onmouseout=function(e){ddtabmenu.revert2default(submenu, tabid, e)} submenu.onmouseover=function(){ddtabmenu.clearrevert2default(tabid)} submenu.onmouseout=function(e){ddtabmenu.revert2default(this, tabid, e)} } } else //for items without a submenu, add onMouseout effect menuitems[x].onmouseout=function(e){this.className=""; if (ddtabmenu.snap2original[0]==true) ddtabmenu.revert2default(this, tabid, e)} menuitems[x].onmouseover=function(){ddtabmenu.showsubmenu(tabid, this)} if (dselected=="auto" && typeof setalready=="undefined" && this.isSelected(menuitems[x].href)){ ddtabmenu.showsubmenu(tabid, menuitems[x]) this[tabid+"-dselected"]=menuitems[x] var setalready=true } else if (parseInt(dselected)==x){ ddtabmenu.showsubmenu(tabid, menuitems[x]) this[tabid+"-dselected"]=menuitems[x] } } } } | init:function(tabid, dselected){ var menuitems=document.getElementById(tabid).getElementsByTagName("a") this[tabid+"-menuitems"]=menuitems for (var x=0; x<menuitems.length; x++){ if (menuitems[x].getAttribute("rel")){ this[tabid+"-menuitems"][x].hasSubContent=true if (ddtabmenu.disabletablinks) menuitems[x].onclick=function(){return false} if (ddtabmenu.snap2original[0]==true){ var submenu=document.getElementById(menuitems[x].getAttribute("rel")) menuitems[x].onmouseout=function(e){ddtabmenu.revert2default(submenu, tabid, e)} submenu.onmouseover=function(){ddtabmenu.clearrevert2default(tabid)} submenu.onmouseout=function(e){ddtabmenu.revert2default(this, tabid, e)} } } else //for items without a submenu, add onMouseout effect menuitems[x].onmouseout=function(e){this.className=""; if (ddtabmenu.snap2original[0]==true) ddtabmenu.revert2default(this, tabid, e)} menuitems[x].onmouseover=function(){ddtabmenu.showsubmenu(tabid, this)} if (dselected=="auto" && typeof setalready=="undefined" && this.isSelected(menuitems[x].href)){ ddtabmenu.showsubmenu(tabid, menuitems[x]) this[tabid+"-dselected"]=menuitems[x] var setalready=true } else if (parseInt(dselected)==x){ ddtabmenu.showsubmenu(tabid, menuitems[x]) this[tabid+"-dselected"]=menuitems[x] } } } } | ||
+ | ddtabmenu.definemenu("menu", 0) | ||
</script> | </script> | ||
Revision as of 21:14, 13 July 2011