window.onload=function(){
var?box=document.getElementById('divselect'),
????title=box.getElementsByTagName('cite')[0],
????menu=box.getElementsByTagName('ul')[0],
????as=box.getElementsByTagName('a'),
????????index=-1;
???
????//?點擊三角時
????title.onclick=function(event){
????????event?=?event?||?window.event;
????????if(event.stopPropagation){
????????????event.stopPropagation;
????????}
????????else{
????????????event.cancelBubble;
????????}
????????menu.style.display?=?"block";
??????//?執(zhí)行腳本
????}??
????
????for(var?i=0;i<as.length;i++){
????????as[i].onmouseover?=?function(){
????????????this.style.background?=?"#456";
????????}
????????as[i].onmouseout?=?function(){
????????????this.style.background?=?"#fff";
????????}
????????
????????as[i].onclick?=?function(event){
????????????event?=?event?||?window.event;
????????????if(event.stopPropagation){
????????????????event.stopPropagation;
????????????}
????????????else{
????????????????event.cancelBubble;
????????????}
????????????menu.style.display?=?"none";
????????????title.innerHTML?=?this.innerHTML;
????????}????????
????}
???//?滑過滑過、離開、點擊每個選項時
??????//?執(zhí)行腳本
????document.onclick?=?function(){
????????????????menu.style.display?=?'none';
????????????};
???//?點擊頁面空白處時
???????//?執(zhí)行腳本
?}
2016-07-30
event.cancelBubble=true;