<MENU> <LI onclick="alert('1')">This is the first item in the menu. <LI onclick="alert('2')">And this is the second item in the menu. </MENU> <script> function document.onclick(){ evt=event.srcElement; if(evt.parentElement.tagName!="MENU") evt.parentElement.style.display="none"; } </script>你要的是这个效果吗?
Menu.style.display='none'
<LI onclick="alert('1')">This is the first item in the menu.
<LI onclick="alert('2')">And this is the second item in the menu.
</MENU>
<script>
function document.onclick(){
evt=event.srcElement;
if(evt.parentElement.tagName!="MENU")
evt.parentElement.style.display="none";
}
</script>你要的是这个效果吗?
我原先用的是document.onmousedown,改成document.click就好了!
谢谢kingdomzhf(旭日东升)和descreekert