Input new attribute range use record in HTML5

Source: Internet
Author: User

After two days there is no computer, no TV, mobile phone and no flow of life, accustomed to such a noisy rhythm, and then back to such a clean environment, is tantamount to a wash, but some fear, as if they do not have anything, if divorced from this civilized society, can even say that I even basic survival ability are not, If I go back to the past, I don't know how long I can live.

Regrets, the current work to be completed, record a HTML5 in the new attribute of input, range. Found this property is in a Web site of the toner, the feeling is indeed more visualized, good-looking, on the record:

The

code is as follows:


<input type= "range" min= "0" max= "255" >


<input type= "text" id= "show" >


The display effect is as follows:





Here you see the two attributes of type Min and Max, the minimum and maximum allowable range. And we can also design this range in style.

Copy Code code as follows:


<input type= "range" min= "0" max= "255" style= height:100px;width:400px;background:yellow; "onchange=" Change () "Id=" range ">


<input type= "text" id= "show" >


The display effect is as follows:





So we're going to write a JS method to change the value, which is applied in the palette: (As for how the Move button style has changed, it's not quite clear).



The
code is as follows:


<script type= "Text/javascript" >


function Change () {


var Num=document.getelementbyid ("range");


var Location=document.getelementbyid ("show");


Location.value=num.value;


}


</script>


In this way, as the drag position changes the value of the input box, put three words can generate color, this is the principle of the toner

Also note here are the other two property value defaults and step changes in range

The toner looks good, turn around and get a look, now go to bed.

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.