color picker


Open browser-standard colorpicker with javascript without type=color
https://stackoverflow.com/questions/29676017/open-browser-standard-colorpicker-with-javascript-without-type-color
1
====================
document.getElementById("xxx").addEventListener("click", function() {
  document.getElementById("c").focus();
  document.getElementById("c").value = "#FFCC00";
  document.getElementById("c").click();
});

.hidden {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

<input type="color" id="c" tabindex=-1 class="hidden">
<input type="button" id="xxx" value="Click Me!">
2
=================================
Works in browsers that support input type=color (firefox, chrome, and opera)
<input type="file" id="filepicker" style="display:none" />
<script>
function pickfile() {
    var elem = document.getElementById('filepicker');
    if(elem)
        elem.click();
}
</script>
Call pickfile()

评论

此博客中的热门博文

XML, XSL, HTML

Input in element.eleme.io

Data URI是由RFC 2397 ACE