Difference between revisions of ":Colours"
From Ingmar de Boer
(Created page with "<noinclude> This widget allows you to add a [https://developers.google.com/youtube/player_parameters YouTube video player] to your wiki page. == Using this widget == For info...") |
|||
Line 1: | Line 1: | ||
− | < | + | <includeonly> |
− | + | <script language="javascript"> | |
− | == | + | var colorhex="#FF0000" |
− | + | function mouseOverColor(hex) | |
+ | { | ||
+ | document.getElementById("divpreview").style.backgroundColor=hex; | ||
+ | document.getElementById("divpreviewtxt").innerHTML=hex; | ||
+ | document.body.style.cursor="pointer"; | ||
+ | } | ||
− | == | + | function clickColor(hex,seltop,selleft) |
− | + | { | |
− | + | var xhttp,c | |
+ | if (hex==0) | ||
+ | { | ||
+ | c=document.getElementById("colorhex").value; | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | c=hex; | ||
+ | } | ||
+ | if (c.substr(0,1)=="#") | ||
+ | { | ||
+ | c=c.substr(1); | ||
+ | } | ||
+ | colorhex="#" + c; | ||
+ | colorhex=colorhex.substr(0,10); | ||
+ | document.getElementById("colorhex").value=colorhex; | ||
+ | if (window.XMLHttpRequest) | ||
+ | { | ||
+ | xhttp=new XMLHttpRequest(); | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | xhttp=new ActiveXObject("Microsoft.XMLHTTP"); | ||
+ | } | ||
+ | xhttp.open("GET","http_colorshades.asp?colorhex=" + c + "&r=" + Math.random(),false); | ||
+ | xhttp.send(""); | ||
+ | document.getElementById("colorshades").innerHTML=xhttp.responseText; | ||
+ | if (seltop>-1 && selleft>-1) | ||
+ | { | ||
+ | document.getElementById("selectedColor").style.top=seltop + "px"; | ||
+ | document.getElementById("selectedColor").style.left=selleft + "px"; | ||
+ | document.getElementById("selectedColor").style.visibility="visible"; | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | document.getElementById("divpreview").style.backgroundColor=colorhex; | ||
+ | document.getElementById("divpreviewtxt").innerHTML=colorhex; | ||
+ | document.getElementById("selectedColor").style.visibility="hidden"; | ||
+ | } | ||
+ | //refreshleader() | ||
+ | } | ||
+ | |||
+ | </script> | ||
+ | </includeonly> |