Home > Web Front-end > JS Tutorial > JavaScript obtains the color picker function that comes with the system (picture)_javascript skills

JavaScript obtains the color picker function that comes with the system (picture)_javascript skills

WBOY
Release: 2016-05-16 18:21:16
Original
2149 people have browsed it

The effect is as shown in the figure:
JavaScript obtains the color picker function that comes with the system (picture)_javascript skills
The following is the code to obtain the color picker that comes with the system:


[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute
]

The advantage is: less code
The disadvantage is: it can only be used under IE. <script> function $(obj) { return document.getElementById(obj); } function pickColor() { if (!window.isIE) return; var sColor = $('dlgHelper').ChooseColorDlg(); var color = sColor.toString(16); while (color.length<6) color="0"+color; window.color = color; color = "#"+color; $('div_color').style.backgroundColor = color; $('div_color').value = color; } var isIE = (document.all && window.ActiveXObject) ? true : false; </script>
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template