JavaScript: Show and hide drop-down menus _ javascript skills

Source: Internet
Author: User
This article describes how to display and hide the drop-down menu in JavaScript. For more information, see this article. The knowledge we need to use to implement JavaScript is:
1) JS event: the onmouseover mouse goes through the event and the onmouseout mouse leaves event.
2) Basic JS Syntax: Use the function keyword to define a function.
3) DOM programming: getElementsByTagName () method.
The next step is our production process:
1) Hide level-2 menus: Set CSS styles to hide level-2 menus.
2) Compile the show sub () function: Use getElementsByTagName to obtain the level-2 menu item, and set the level-2 menu display through style. display.
3) Compile the hidesub () function of the hidden sub-menu: Use getElementsByTagName to obtain the level-2 menu item, and set level-2 menu hiding through style. display.
4) Add a mouse event: Add a mouse event to a level-1 menu with a level-2 menu, and call the showsub ()/hidesub () function to display and hide the mouse over the level-1 menu.
5) perform browser compatibility check. There are at least five browsers. IE7, 2345, Firefox, Google, and browsers.

:

HTML code:

   
  Drop-down menu 
  
  
  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.