Home > Web Front-end > JS Tutorial > js method to implement Select drop-down box with input function_javascript skills

js method to implement Select drop-down box with input function_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 16:15:20
Original
1489 people have browsed it

The example in this article describes the method of using js to implement the input function of the Select drop-down box. Share it with everyone for your reference. The specific implementation method is as follows:

Implementation Method 1

Copy code The code is as follows:



JS implements input drop-down box







Implementation method two

Copy code The code is as follows:


<script><br> var Select = {<br> del : function(obj,e){<br> if((e.keyCode||e.which||e.charCode) == 8){<br> var opt = obj.options[0];<br> opt.text = opt.value = opt.value.substring(0, opt.value.length>0?opt.value.length-1:0);<br> }<br> },<br> write : function(obj,e){<br> if((e.keyCode||e.which||e.charCode) == 8)return ;<br> var opt = obj.options[0];<br> opt.selected = "selected";<br> opt.text = opt.value = String.fromCharCode(e.charCode||e.which||e.keyCode);<br> }<br> }<br> function test(){<br> alert(document.getElementById("select").value);<br> }<br> </script>

I hope this article will be helpful to everyone’s JavaScript programming design.

Related labels:
source:php.cn
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
Latest Issues
Where is js written?
From 1970-01-01 08:00:00
0
0
0
js addClass not working
From 1970-01-01 08:00:00
0
0
0
js file code not found
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template