Home >Web Front-end >JS Tutorial >JS code that dynamically changes web page background color by mouse selection_javascript skills
Using Javascript to implement, click the corresponding color with the mouse to dynamically change the background color of the web page
This is a screenshot
The corresponding Javascript source code is:
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('
') drawTable(hex[i]) document.write(' | ')