This article mainly introduces the JS Code for dynamically changing the webpage background color with the mouse. If you need it, you can refer to the Javascript implementation. Click the corresponding color with the mouse to dynamically change the webpage background color.
This is
The corresponding Javascript source code is:
The Code is as follows:
Var hex = new Array (6)
Hex [0] = "FF"
Hex [1] = "CC"
Hex [2] = "99"
Hex [3] = "66"
Hex [4] = "33"
Hex [5] = "00"
Function display (triplet ){
Document. bgColor = '#' + triplet
}
Function drawCell (red, green, blue ){
Document. write ('')
Document. write ('')
Document. write ('')
Document. write ('')
Document. write ('')
}
Function drawRow (red, blue ){
Document. write ('')
For (var I = 0; I <6; ++ I ){
DrawCell (red, hex [I], blue)
}
Document. write ('')
}
Function drawTable (blue ){
Document. write ('
')For (var I = 0; I <6; ++ I ){DrawRow (hex [I], blue)}Document. write ('
')
}
Function drawCube (){
Document. write ('
')For (var I = 0; I <6; ++ I ){Document. write ('
')
DrawTable (hex [I])
Document. write (' | ')}Document. write ('
')
}
DrawCube ()