Home Web Front-end JS Tutorial js code to simulate select drop-down menu control_javascript skills

js code to simulate select drop-down menu control_javascript skills

May 16, 2016 pm 05:34 PM
select simulation

Copy code The code is as follows:


 
 
 
 
 js模拟select
 
   
 
  

          

            

                

select选择


                
                

                        
  • jq的select模拟1

  •                     
  • jq的select模拟2

  •                     
  • jq的select模拟3

  •                 

            

            

                

select选择2


                
                

                        
  • jq的select模拟11

  •                     
  • jq的select模拟22

  •                     
  • jq的select模拟31

  •                 

            


        

 

   <script><br><br>     window.onload=function(){<br>     var oflink = document.getElementById('sel');<br>     var aDt = oflink.getElementsByTagName('dt');<br>     var aUl = oflink.getElementsByTagName('ul');<br>     var aH3= oflink.getElementsByTagName('h3');<br>     for(var i=0;i<aDt.length;i ){<br>         aDt[i].index = i;<br>         aDt[i].onclick = function(ev){<br>             var ev = ev || window.event;<br>             var This = this;<br>             for(var i=0;i<aUl.length;i ){<br>                 aUl[i].style.display = 'none';<br>             }<br>             aUl[this.index].style.display = 'block';<br>             document.onclick = function(){<br>                 aUl[This.index].style.display = 'none';<br>             };<br>             ev.cancelBubble = true;<br><br>         };<br>     }<br>     for(var i=0;i<aUl.length;i ){<br><br>         aUl[i].index = i;<br><br>         (function(ul){<br><br>             var iLi = ul.getElementsByTagName('li');<br><br>             for(var i=0;i<iLi.length;i ){<br>                 iLi[i].onmouseover = function(){<br>                     this.className = 'hover';<br>                 };<br>                 iLi[i].onmouseout = function(){<br>                     this.className = '';<br>                 };<br>                 iLi[i].onclick = function(ev){<br>                     var ev = ev || window.event;<br>                     aH3[this.parentNode.index].innerHTML = this.innerHTML;<br>                     ev.cancelBubble = true;<br>                     this.parentNode.style.display = 'none';<br>                 };<br>             }<br><br>         })(aUl[i]);<br>     }<br><br> }<br>   </script>

 
 
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Asynchronous processing method of Select Channels Go concurrent programming using golang Asynchronous processing method of Select Channels Go concurrent programming using golang Sep 28, 2023 pm 05:27 PM

Asynchronous processing method of SelectChannelsGo concurrent programming using golang Introduction: Concurrent programming is an important area in modern software development, which can effectively improve the performance and responsiveness of applications. In the Go language, concurrent programming can be implemented simply and efficiently using Channels and Select statements. This article will introduce how to use golang for asynchronous processing methods of SelectChannelsGo concurrent programming, and provide specific

How to hide the select element in jquery How to hide the select element in jquery Aug 15, 2023 pm 01:56 PM

How to hide the select element in jquery: 1. hide() method, introduce the jQuery library into the HTML page, you can use different selectors to hide the select element, the ID selector replaces the selectId with the ID of the select element you actually use; 2. css() method, use the ID selector to select the select element that needs to be hidden, use the css() method to set the display attribute to none, and replace selectId with the ID of the select element.

AI simulator takes the new SOTA in physics simulation! AI simulator takes the new SOTA in physics simulation! Feb 19, 2024 pm 06:50 PM

Machine learning makes computer graphics (CG) simulations more realistic! The method is called Neural Flow Maps (NFM), which can accurately simulate smoke with four vortices: more complex ones can also be easily realized: you know, in this era of AI applications flying all over the sky, CG physics simulation is still It is the world of traditional numerical algorithms. △NFM simulates "leapfrog". Although the application of neural networks in CG can create dazzling visual effects, it cannot strictly and robustly describe physical properties. △NFM simulates "ink droplets" It is precisely for this reason that physical simulation based on neural networks is still in the proof of concept stage, and the effects generated are far from SOTA. In order to solve this complex problem,

Using Transformer as a general-purpose computer, it can also execute in-context learning algorithms. This research is very imaginative. Using Transformer as a general-purpose computer, it can also execute in-context learning algorithms. This research is very imaginative. Apr 13, 2023 am 11:31 AM

Transformer has become a popular choice for various machine learning tasks and has achieved great results, so how else can it be used? Researchers with great imagination actually want to use it to design programmable computers! The authors of this paper, titled "Looped Transformers as Programmable Computers", are from Princeton University and the University of Wisconsin, and aim to explore how to use Transformers to implement general-purpose computers. Specifically, the authors propose a framework for using transformer networks as general-purpose computers by programming them with specific weights and placing them in loops. in this framework

How to implement change event binding of select elements in jQuery How to implement change event binding of select elements in jQuery Feb 23, 2024 pm 01:12 PM

jQuery is a popular JavaScript library that can be used to simplify DOM manipulation, event handling, animation effects, etc. In web development, we often encounter situations where we need to change event binding on select elements. This article will introduce how to use jQuery to bind select element change events, and provide specific code examples. First, we need to create a dropdown menu with options using labels:

What is the reason why Linux uses select? What is the reason why Linux uses select? May 19, 2023 pm 03:07 PM

Because select allows developers to wait for multiple file buffers at the same time, it can reduce IO waiting time and improve the IO efficiency of the process. The select() function is an IO multiplexing function that allows the program to monitor multiple file descriptors and wait for one or more of the monitored file descriptors to become "ready"; the so-called "ready" state is Refers to: the file descriptor is no longer blocked and can be used for certain types of IO operations, including readable, writable, and exceptions. select is a computer function located in the header file #include. This function is used to monitor file descriptor changes—reading, writing, or exceptions. 1. Introduction to the select function. The select function is an IO multiplexing function.

How to use the select syntax of mysql How to use the select syntax of mysql Jun 01, 2023 pm 07:37 PM

1. Keywords in SQL statements are not case-sensitive. SELECT is equivalent to SELECT, and FROM is equivalent to from. 2. To select all columns from the users table, you can use the symbol * to replace the column name. Syntax--this is a comment--query out [all] data from the [table] specified by FEOM. * means [all columns] SELECT*FROM--query out the specified data from the specified [table] from FROM Data of column name (field) SELECT column name FROM table name instance--Note: Use English commas to separate multiple columns selectusername, passwordfrom

Implement Select Channels Go concurrent programming performance optimization through golang Implement Select Channels Go concurrent programming performance optimization through golang Sep 27, 2023 pm 01:09 PM

Implementing SelectChannels through golang Performance optimization of Go concurrent programming In the Go language, it is very common to use goroutine and channel to implement concurrent programming. When dealing with multiple channels, we usually use select statements for multiplexing. However, in the case of large-scale concurrency, using select statements may cause performance degradation. In this article, we will introduce some implementations of select through golang

See all articles