javascript - How to invert the forecolor and backcolor when any one of them changes -
I am using a Ajaxtotee to choose a color.
If selected as a black color, its related foreclosure should be set white and vice versa.
I want to do this with javascript
& lt; Script type = "text / javascript" & gt; Change function color (sender) {// sender.get_element (). Style.color = // "#" + sender.get_sainted color (); Sender.get_element () Value = "#" + sender .get_selectedColor (); } & Lt; / Script & gt;
The back color is being set by AJAX Javascript. sender.get_selectedColor (); What color can be set using
. How to reverse this color I think it is possible using regex
, but do not know how to do it.
You need to get every color complex from RRGGB, return it back and then return the glue:
function number ohex (nValue, nLength / * = 2 * /) {var sValue = Math.abs (. Math.floor (nValue)) toString (16); If (! NLength) nLength = 2; If (sValue.length & lt; nLength) sValue = Array (nLength + 1 - sValue.length). Joint ('0') + sValue; Return sValue; }; Inverted = numatohex (255 - persian (original substrraft (0, 2), 16)) + number ofax (255 - persint (original. Subert (2, 2), 16)) + numbertox (255 - persint (original 4, 2 ), 16));
Comments
Post a Comment