在網頁的任意處點擊左鍵就會彈出來,實際上是用JS控制DIV層的顯示,DIV層內嵌套的是一個表格,表格裡放菜單,這樣修改方便,不會CSS也沒關系,你可以把它復制下來,用DW打開重新修改一下菜單樣式,換成你自己喜歡的色彩
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>隱藏菜單</title> <style type="text/css"> body { font: 9pt; } .box { font: 9pt "宋體"; position: absolute; background: skyblue; } </style> </head> <body> <table cellpadding="5" id="itemopen" class="box" style="display:none"> <tr> <td bgcolor="#0066cc">網站導航:</td> </tr> <tr> <td><a href="/">AJAX實例</a></td> </tr> <tr> <td><a href="/jscss/">jQuery相關</a></td> </tr> <tr> <td><a href="/jscss/">ExtJS演示</a></td> </tr> </table> </center> </div> <script language="JavaScript"> document.onclick = popUp function popUp() { newX = window.event.x + document.body.scrollLeft newY = window.event.y + document.body.scrollTop menu = document.all.itemopen if ( menu.style.display == ""){ menu.style.display = "none" } else { menu.style.display = ""} menu.style.pixelLeft = newX - 50 menu.style.pixelTop = newY - 50 } </script> <body> <p align="center"><font size="3">點擊左鍵看看?</p> </body> </html>希望本文所述對大家的javascript程序設計有所幫助。