Home Web Front-end JS Tutorial A drop-down box with checkbox implemented by js csss_javascript skills

A drop-down box with checkbox implemented by js csss_javascript skills

May 16, 2016 pm 04:34 PM
drop down box checkbox

Rendering:

css:

<style type="text/css"> 
/* 带复选框的下拉框 */ 
ul li{ 
list-style: none; 
padding:0px; 
margin: 0px; 
} 

.select_checkBox{ 
border:0px solid red; 
position: relative; 
display:inline-block; 


} 
.chartQuota{ 
height:23px; 
float:left; 
display:inline-block; 
border:0px solid black; 
position: relative; 
} 

.chartOptionsFlowTrend{ 
z-index:300; 
background-color:white; 
border:1px solid gray; 
display:none; 
position: absolute; 
left:0px; 
top:23px; 
width:150px; 
} 
.chartOptionsFlowTrend ul{ 
float:left; 
padding: 0px; 
margin: 5px; 
} 
.chartOptionsFlowTrend li{ 
/* float:left; */ 
display:block; 
position: relative; 
left:0px; 
margin: 0px; 
clear:both; 
} 
.chartOptionsFlowTrend li *{ 
float:left; 
} 
a:-webkit-any-link { 
color: -webkit-link; 
text-decoration: underline; 
cursor: auto; 
} 
.chartQuota p a { 
float: left; 
height: 21px; 
outline: 0 none; 
border: 1px solid #ccc; 
line-height: 22px; 
padding: 0 5px; 
overflow: hidden; 
background: #eaeaea; 
color: #313131; 
text-decoration: none; 
} 

.chartQuota p { 
margin:0px; 
folat:left; 
overflow: hidden; 
height: 23px; 
line-height:24px; 
display: inline-block; 
} 
.chartOptionsFlowTrend p { 
height: 23px; 
line-height: 23px; 
overflow: hidden; 
position: relative; 
z-index: 2; 
background: #fefbf7; 
padding-top: 0px; 
display: inline-block; 
} 
.chartOptionsFlowTrend p a { 
border: 1px solid #fff; 
margin-left: 15px; 
color: #2e91da; 
} 
</style>
Copy after login

html:

<div class="select_checkBox"> 
<div class="chartQuota"> 
<p> 
<a href="javascript:;" hidefocus="true" title="请选择指标"><span>选择指标</span> 
<b></b> 
</a> 
</p> 

</div><br> 
<div class="chartOptionsFlowTrend""> 
<ul> 
<li class=""><input type="checkbox" value="1"><span>浏览次数(PV)</span> 
</li> 
<li class=""><input type="checkbox" value="1"><span>独立访客(UV)</span> 
</li> 
<li class=""><input type="checkbox" value="1"><span>IP</span> 
</li> 
<li class=""><input type="checkbox" value="1"><span>新独立访客</span> 
</li> 
<li class=""><input type="checkbox" value="1"><span>访问次数</span> 
</li> 
</ul> 
<p> 
<a href="javascript:;" title="确定" hidefocus="true" class="a_0">确定</a><a 
href="javascript:;" title="取消" hidefocus="true" class="a_1">取消</a> 
</p> 
</div> 
</div>
Copy after login

js:

<script type="text/javascript"> 
$(function(){ 
$(".select_checkBox").hover(function(){ 
$(".chartOptionsFlowTrend").css("display","inline-block"); 
},function(){ 
$(".chartOptionsFlowTrend").css("display","none"); 
}); 
}); 
</script>
Copy after login
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)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 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)

Use jQuery to implement real-time updates of checkbox selected status Use jQuery to implement real-time updates of checkbox selected status Feb 23, 2024 pm 03:45 PM

Using jQuery to Real-time Update the Selected Status of Check Boxes In web development, we often encounter situations where we need to update the selected status of check boxes in real time. By using jQuery, we can easily implement the function of updating the selected status of the check box in real time. Here's how to use jQuery to accomplish this task. First, we need to prepare a simple HTML structure containing multiple checkboxes:

How to use checkbox component in uniapp How to use checkbox component in uniapp Jul 04, 2023 pm 12:05 PM

How to use the checkbox component in uniapp In uniapp, the checkbox component is a common user interaction component and is often used for multi-option selection. This article will introduce how to use the checkbox component in uniapp and provide code examples. Introducing the checkbox component In the page that needs to use the checkbox component, you first need to introduce the uniapp checkbox component. You can add the following code to the .vue file of the page: &lt;template&gt;&lt;view&gt;

How to implement a multi-select drop-down box in Vue How to implement a multi-select drop-down box in Vue Nov 07, 2023 pm 02:09 PM

How to implement a multi-select drop-down box in Vue. In Vue development, the drop-down box is one of the common form components. Normally, we use radio drop-down boxes to select an option. However, sometimes we need to implement a multi-select drop-down box so that users can select multiple options at the same time. In this article, we will introduce how to implement a multi-select drop-down box in Vue and provide specific code examples. 1. Use the ElementUI component library. ElementUI is a desktop component library based on Vue, which provides a rich UI.

Use jQuery to determine the checked state of a checkbox Use jQuery to determine the checked state of a checkbox Feb 25, 2024 pm 12:18 PM

How to tell if a checkbox is selected using jQuery? In web development, we often encounter situations where we need to determine whether a check box is selected. This functionality can be easily achieved using jQuery. The following will introduce how to use jQuery to determine whether a check box is selected, and attach specific code examples. First, make sure to include the jQuery library in your HTML page:

Vue mobile drop-down box scrolling problem solution Vue mobile drop-down box scrolling problem solution Jun 29, 2023 pm 11:49 PM

How to solve the mobile drop-down box scrolling problem in Vue development. With the popularity of mobile terminals, more and more web applications have begun to be developed for mobile devices. In the process of mobile development, we often encounter a problem, which is the scrolling problem of the drop-down box on mobile devices. On the traditional PC side, the scrolling of the drop-down box is controlled by the browser's default scroll bar, but on mobile devices, there is no scroll bar, so the drop-down box cannot be scrolled. This may cause the user to be unable to select all options in the drop-down box in some scenarios.

Investigate how jQuery handles checking and deselecting checkboxes Investigate how jQuery handles checking and deselecting checkboxes Feb 26, 2024 am 08:09 AM

jQuery is a popular JavaScript library used to simplify DOM operations, event handling, animation effects, etc. in web development. In web pages, checkboxes are a common form element used to enable users to select multiple options. This article will explore how to use jQuery to handle checkbox selection and deselecting operations, and provide specific code examples. 1. Basic knowledge of check boxes In HTML, check boxes are represented as follows:

How to use JavaScript to achieve drop-down box linkage effect? How to use JavaScript to achieve drop-down box linkage effect? Oct 20, 2023 pm 03:57 PM

How to use JavaScript to achieve drop-down box linkage effect? In developing web pages, drop-down box linkage is a common interactive effect. It dynamically changes the option content of another drop-down box by selecting an option in one drop-down box, thereby achieving linkage between the two. This article will introduce how to use JavaScript to achieve the linkage effect of drop-down boxes, and attach specific code examples. HTML structure First, we need to create two drop-down boxes and add id attributes to them so that JavaScr

Vue component development: drop-down box component implementation method Vue component development: drop-down box component implementation method Nov 24, 2023 am 09:33 AM

Vue component development: drop-down box component implementation method In Vue development, the drop-down box (Dropdown) is a common UI component. A drop-down box is used to display a set of options and allow the user to select one or more options. This article will introduce how to use Vue to implement a simple drop-down box component through specific code examples. First, we need to create a single file component called Dropdown.vue. In the component's template, we can use Vue's instruction v-for to loop through the selections of the drop-down box.

See all articles