Home Web Front-end HTML Tutorial How to use button trigger to achieve background color flashing

How to use button trigger to achieve background color flashing

Feb 08, 2018 am 09:51 AM
accomplish scenery trigger

This time I will show you how to use the button to trigger the flashing of the background color. What are the precautions for using the button to trigger the flashing of the background color. The following is a practical case. Let’s take a look.

To achieve the background color flashing effect, just add the following code to the <body> area

1

2

3

4

5

6

7

8

9

10

11

12

13

14

&lt;script language=&quot;Javascript&quot;&gt;

function blinkit()

{

 intrvl=0;

 for(nTimes=0;nTimes&lt;3;nTimes++)

 {

 intrvl += 200;

 setTimeout(&quot;document.bgColor=&#39;#0000FF&#39;;&quot;,intrvl);

 intrvl += 200;

 setTimeout(&quot;document.bgColor=&#39;#336699&#39;;&quot;,intrvl);

 }

}

&lt;/script&gt;

&lt;input type=&quot;button&quot; value=&quot;Blink&quot; onClick=&quot;blinkit()&quot;&gt;

Copy after login

I believe you have mastered the method after reading these cases, please come for more exciting Pay attention to other related articles on php Chinese website!

Related reading:

How to upload files asynchronously in html

The margin-top element in the div tag is invalid Solution

#iframe node initialization

The above is the detailed content of How to use button trigger to achieve background color flashing. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to implement dual WeChat login on Huawei mobile phones? How to implement dual WeChat login on Huawei mobile phones? Mar 24, 2024 am 11:27 AM

How to implement dual WeChat login on Huawei mobile phones?

Use Java to write code to implement love animation Use Java to write code to implement love animation Dec 23, 2023 pm 12:09 PM

Use Java to write code to implement love animation

How to implement the WeChat clone function on Huawei mobile phones How to implement the WeChat clone function on Huawei mobile phones Mar 24, 2024 pm 06:03 PM

How to implement the WeChat clone function on Huawei mobile phones

PHP Programming Guide: Methods to Implement Fibonacci Sequence PHP Programming Guide: Methods to Implement Fibonacci Sequence Mar 20, 2024 pm 04:54 PM

PHP Programming Guide: Methods to Implement Fibonacci Sequence

PHP Game Requirements Implementation Guide PHP Game Requirements Implementation Guide Mar 11, 2024 am 08:45 AM

PHP Game Requirements Implementation Guide

Master how Golang enables game development possibilities Master how Golang enables game development possibilities Mar 16, 2024 pm 12:57 PM

Master how Golang enables game development possibilities

Development suggestions: How to use the ThinkPHP framework to implement asynchronous tasks Development suggestions: How to use the ThinkPHP framework to implement asynchronous tasks Nov 22, 2023 pm 12:01 PM

Development suggestions: How to use the ThinkPHP framework to implement asynchronous tasks

Why does event bubbling trigger twice? Why does event bubbling trigger twice? Feb 22, 2024 am 09:06 AM

Why does event bubbling trigger twice?

See all articles