»
EnglishFrenchVietnamese

Print - Random-Background-Colors onDoublelick - JavaScriptBank.com

Full version: jsB@nk » Background » Random-Background-Colors onDoublelick
URL: https://www.javascriptbank.com/random-background-color-ondoublelick.html

Random-Background-Colors onDoublelick © JavaScriptBank.comDoubleclick in anywhere to get a random background-color. Navigator 4.x and Explorer 4.x

Full version: jsB@nk » Background » Random-Background-Colors onDoublelick
URL: https://www.javascriptbank.com/random-background-color-ondoublelick.html



JavaScript
<script language="javascript">/*     This script downloaded from www.JavaScriptBank.com     Come to view and download over 2000+ free javascript at www.JavaScriptBank.com*/<!-- Beginning of JavaScript -// Random-Background-Color onDoublelickfunction makeRandom(range) {rand=Math.floor(range*Math.random())    return rand}function makeHexa(thiscol) {    var colhex_left = Math.floor(thiscol/16)    var colhex_right= thiscol-(colhex_left*16)    if (colhex_left == 10) {colhex_left="A"}    if (colhex_left == 11) {colhex_left="B"}    if (colhex_left == 12) {colhex_left="C"}    if (colhex_left == 13) {colhex_left="D"}    if (colhex_left == 14) {colhex_left="E"}    if (colhex_left == 15) {colhex_left="F"}      if (colhex_right == 10) {colhex_right="A"}    if (colhex_right == 11) {colhex_right="B"}    if (colhex_right == 12) {colhex_right="C"}    if (colhex_right == 13) {colhex_right="D"}    if (colhex_right == 14) {colhex_right="E"}    if (colhex_right == 15) {colhex_right="F"}        var colhex =""+colhex_left+colhex_right    return colhex}function dblclick() {   var redcolor=makeRandom(255)redcolor=makeHexa(redcolor)var greencolor=makeRandom(255)greencolor=makeHexa(greencolor)var bluecolor=makeRandom(255)bluecolor=makeHexa(bluecolor)    document.bgColor=""+redcolor+greencolor+bluecolor}if (document.layers) {document.captureEvents(Event.ONDBLCLICK);}document.ondblclick=dblclick;// - End of JavaScript - --></SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->