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
WBOYOriginal
2016-05-16 18:21:162134browse

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>
Statement:
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