-1
這是菜單的JavaScript代碼,此腳本採用鼠標懸停事件的形式。但我需要將其更改爲鼠標單擊事件。請幫我改變這一個。如何將Mouse over Event事件更改爲鼠標單擊以下代碼中的事件
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
}
}
對於樣品請參閱下面的鏈接。 Click Here to View the Sample of it http://www.javascriptkit.com/script/script2/tabset/index.shtml
使用此'document.querySelectorAll( '#dolphinnav> ul>李:第一> A')。addClass( '當前' );' – asifsid88 2013-02-12 10:17:46
在哪個地方我應該放置代碼兄弟..對不起,我是新來的..請儘量幫助我。 – coolprarun 2013-02-12 10:25:07