Create your blog and photo album with postbit
Create your blog and photo album

Create new post

Content:

Upload a picture:
Tags (keywords separated by comma)

Save Cancel
The JavaScript Blog js:   Followers: 3 ; Following: 3

Explore The JavaScript Blog's photo albums:
Javascript tools (2)
Photos from posts (7)

HTML5 Slider


Use HTML5 slider to change bar color. Each slider changes a color component (Red, Green and Blue).
Values can be changed between 0 and 255.

Move sliders to change color:














Red:
Green:
Blue:

There are 255*255*255 = 16,581,375 colors that you can create with RGB combination.



How to create a slider bar using HTML5 ?

This is the source code to create a slider bar using HTML 5:
<input type="range" min="0" max="255" value="128">
(this creates a slider with minimum value "0" and maximum value "255" and sets the default value to "128").



How to convert DECIMAL to HEXADECIMAL (dec to hex) using JavaScript?


var value_decimal = '255';
// value_hexadecimal will be 'FF'
var value_hexadecimal = parseInt(value_decimal).toString(16).toUpperCase();
parseInt() was needed because if value_decimal is a text string, then it will be converted to number.

If you need fixed 2 characters (eg: '0F' instead of 'F'), add this:
if (value_hexadecimal.length==1) {
value_hexadecimal = '0' + value_hexadecimal;
}

// This also works:
// "00".substr(0, 2 - value_hexadecimal.length) + value_hexadecimal




How to convert HEXADECIMAL to DECIMAL (hex to dec) using JavaScript?


var value_hexadecimal = 'ff';
// value_decimal will be '255'
var value_decimal = parseInt(value_hexadecimal, 16);


Post by The JavaScript Blog (2011-11-08 12:41)

Post your comment:

Name: Email: Site:




| Explore users | New posts | Create your blog | Create your photo album |
| About Postbit | Our blog | Terms of use | Contact Postbit |


Copyright © 2017 - postbit.com