This is JavaScript code for menu's. This script is in the form of Mouse Over Event, but I need to change it to Mouse Click Event. Please help me to change this one.
var dolphintabs={subcontainers:[], last_accessed_tab:null,
revealsubmenu:function(curtabref){
this.hideallsubs()
if (this.last_accessed_tab!=null)
this.last_accessed_tab.className=""
if (curtabref.getAttribute("rel")) //If there's a sub menu defined for this tab item, show it
document.getElementById(curtabref.getAttribute("rel")).style.display="block"
curtabref.className="current"
this.last_accessed_tab=curtabref
},
hideallsubs:function(){
for (var i=0; i<this.subcontainers.length; i++)
document.getElementById(this.subcontainers[i]).style.display="none"
},
init:function(menuId, selectedIndex){
var tabItems=document.getElementById(menuId).getElementsByTagName("a")
for (var i=0; i<tabItems.length; i++){
if (tabItems[i].getAttribute("rel"))
this.subcontainers[this.subcontainers.length]=tabItems[i].getAttribute("rel") //store id of submenu div of tab menu item
if (i==selectedIndex){ //if this tab item should be selected by default
tabItems[i].className="current"
this.revealsubmenu(tabItems[i])
}
tabItems[i].onmouseover=function(){
dolphintabs.revealsubmenu(this)
}
} //END FOR LOOP
}
}
For Sample Please See the below Link. Click Here to View the Sample of it http://www.javascriptkit.com/script/script2/tabset/index.shtml
Change this
tabItems[i].onmouseover=function(){
dolphintabs.revealsubmenu(this)
}
to
tabItems[i].onclick=function(){
dolphintabs.revealsubmenu(this)
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.