JavaScript gets the system's own color selector function (Fig) _javascript tips

Source: Internet
Author: User
The effect is as shown in the figure:

Here's the code to get the color selector from the system:
<textarea id="runcode12479"><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> <object id= "Dlghelper" classid= "clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" width= "0px" HEIGHT= " 0px "></OBJECT> <input class=" Inputtext "id= ' div_color ' value= ' #000000"/> <input type= "button" value = ' Get color ' onclick= ' Pickcolor () ></textarea>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

The advantage is: The code is relatively small
The disadvantage is: only IE under use.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.