Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
dmd4470/example.html
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
32 lines (26 sloc)
957 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<p>An example demonstrating the use of the <code><input type="color"></code> | |
control.</p> | |
<label for="colorWell">Color:</label> | |
<input type="color" value="#ff0000" id="colorWell"> | |
<p>Watch the paragraph colors change when you adjust the color picker. | |
As you make changes in the color picker, the first paragraph's | |
color changes, as a preview (this uses the <code>input</code> | |
event). When you close the color picker, the <code>change</code> | |
event fires, and we detect that to change every paragraph to | |
the selected color.</p> | |
<script> | |
var colorWell; | |
var defaultColor = "#0000ff"; | |
window.addEventListener("load", startup, false); | |
function startup() { | |
colorWell = document.querySelector("#colorWell"); | |
colorWell.value = defaultColor; | |
colorWell.addEventListener("input", updateFirst, false); | |
colorWell.addEventListener("change", updateAll, false); | |
colorWell.select(); | |
} | |
</script> | |
</body> | |
</html> |