This article describes the method of JS implementing gradient background color when entering a page. Share it for your reference. The specific implementation method is as follows:
<html><head><title>JS implements the gradient background color effect of the gradient when entering the page</title><SCRIPT Language="JavaScript"><!-- Screen color change program-->function CBgColor(){var color = 0, step = 1//color is the initial color, and step is the initial step while( color <= 0xffffff){//Before the color turns white (color=0xffffff), continue to increase the color value document.bgColor = colorcolor += step step <<= 8//Step bit is bit-to-left 8 bits (multiply by 256)if( step >= 0x1000000) step = 1//If the step size is too large, restore it to 1}}CBgColor()//Call the background color change program when loading</Script></head><body onLoad="CBgColor()"><p><b>The gradient background color feels good, right? </b></p></body></html>I hope this article will be helpful to everyone's JavaScript programming.