JavaScript obtains the color selector function that comes with the system. This function is for IE browsers. If you want to use code with better compatibility, you can view articles related to the script house. Effect:
The following code gets the color selector that comes with the system:
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; $ ('P _ color '). style. backgroundColor = color; $ ('P _ 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 "style = 'width: 50px; cursor: hand; 10px; background-color: #000000; color: # ffffff; 'id = 'P _ color' value = "#000000"/> <input type = "button" value = 'retrieve color' onclick = "pickColor ()">
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
Advantage: less code
Disadvantage: it can only be used in IE.