Use button trigger events to achieve background color flashing effect

Use button trigger events to achieve background color flashing effect
To achieve the background color flashing effect, just add the following code to the <body> area.

Copy code
The code is as follows:

<script language="Javascript">
function blinkit()
{
intrvl=0;
for(nTimes=0;nTimes<3;nTimes++)
{
intrvl += 200;
setTimeout("document.bgColor='#0000FF';",intrvl);
intrvl += 200;
setTimeout("document.bgColor='#336699';",intrvl);
}
}
</script>
<input type="button" value="Blink" onClick="blinkit()">

<<:  JS array loop method and efficiency analysis comparison

>>:  CSS writing format, detailed explanation of the basic structure of a mobile page

Recommend

Pure CSS and Flutter realize breathing light effect respectively (example code)

Last time, a very studious fan asked if it was po...

JavaScript to implement simple tab bar switching content bar

This article shares the specific code of JavaScri...

Detailed explanation of js event delegation

1. Each function is an object and occupies memory...

Implementing a web calculator with native JavaScript

This article shares the specific code of JavaScri...

js to achieve the complete steps of Chinese to Pinyin conversion

I used js to create a package for converting Chin...

Can MySQL's repeatable read level solve phantom reads?

introduction When I was learning more about datab...

How to implement blank space in Taobao with CSS3

Make a blank space for Taobao: When you shrink th...

Linux process management tool supervisor installation and configuration tutorial

Environment: CentOS 7 Official documentation: htt...

Detailed discussion on the issue of mysqldump data export

1. An error (1064) is reported when using mysqldu...

How to customize at and cron scheduled tasks in Linux

There are two types of scheduled tasks in Linux s...

MySQL installation tutorial under Linux centos7 environment

Detailed introduction to the steps of installing ...