The example in this article describes the web page background lightning flashing effect code implemented by JS. Share it with everyone for your reference, the details are as follows:
This JavaScript special effects code can realize the lightning flashing special effect of the web page background. Click the button on the web page to activate the effect. It is a very cool effect. Careful JS enthusiasts will find that it actually changes the background color of the web page from " "Black" quickly changes to "White", forming a "lightning" effect.
The online demo address is as follows:
http://demo.jb51.net/js/2015/js-lightning-style-bgcolor-demo/
The specific code is as follows:
<html> <head> <title>闪电闪烁背景</title> </head> <body> <script LANGUAGE="JavaScript"> function blinkOn(){ theWin.document.bgColor = "000000" nTimes++ JSCTimeOutID = window.setTimeout("blinkOff()",50); } function blinkOff(){ theWin.document.bgColor = "FFFFFF" if (nTimes < 3) JSCTimeOutID = window.setTimeout("blinkOn()",50); else theWin.history.go(0) } function blinkit(aWin) { nTimes = 0 theWin = aWin JSCTimeOutID = window.setTimeout("blinkOn()",50); } </script> <form> <div align="center"> <center> <p> <input TYPE="BUTTON" VALUE="欢迎光临脚本之家" onClick="blinkit(self)"> </p> </center> </div> </form> </body> </html>
I hope this article will be helpful to everyone in JavaScript programming.