javascript implements the method of popup hidden menu by clicking the left button anywhere in the web page

  • 2020-06-12 08:25:51
  • OfStack

In fact, JS controls the display of THE DIV layer. The DIV layer is nested with a table in which there are menus. In this way, it is easy to modify

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> The hidden menu </title>
<style type="text/css">
body {
 font: 9pt;
.box {
 font: 9pt " Song typeface ";
 position: absolute;
 background: skyblue;
<table cellpadding="5" id="itemopen" class="box" style="display:none">
  <td bgcolor="#0066cc"> Website navigation: </td>
  <td><a href="/">AJAX The instance </a></td>
  <td><a href="/jscss/">jQuery related </a></td>
  <td><a href="/jscss/">ExtJS demo </a></td>
<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 ( == ""){ = "none" }
 else { = ""} = newX - 50 = newY - 50
<p align="center"><font size="3"> Left click to see? </p>

Hopefully, this article has been helpful in your javascript programming.

Related articles: