\";img[ 1]= \" & lt" />

Joke Collection Website - Bulletin headlines - How to use javascript to display circularly in web pages?

How to use javascript to display circularly in web pages?

Or an array.

Declare a global variable var I = 0;;

Then write the following in the function.

var img = new Array();

img[0]= " & lt; img src = ' path ' > ";

img[ 1]= " & lt; img src = ' path ' > ";

Give as many pictures as you have [].

If (the length of i> array) (

I = 0;

}

Then find the img tag in the text. You need an ID="img 1 ". then

document . getelementbyid(" img 1 ")。 src = img[I];

Then write a setInterval ("function name ()", 1000) outside the function.

General characteristics

JavaScript is a scripting language belonging to the network, which has been widely used in Web application development, and is often used to add various dynamic functions to web pages to provide users with smoother and more beautiful browsing effects. Usually JavaScript scripts are embedded in HTML to realize their own functions. ?

Is an interpreted scripting language (the code is not precompiled).

Mainly used to add interactive behavior to HTML (an application under standard generalized markup language) pages. ?

You can embed HTML pages directly, but writing a js file alone is beneficial to the separation of structure and behavior. ?

Cross-platform features, with the support of most browsers, can run on a variety of platforms (such as Windows, Linux, Mac, Android, iOS, etc. ).

Like other languages, Javascript scripting languages have their own basic data types, expressions and arithmetic operators, as well as the basic program framework of programs. Javascript provides four basic data types and two special data types for processing data and words. Variables provide a place to store information, while expressions can complete more complex information processing. ?

Daily use

Embedding dynamic text in HTML pages.

Respond to browser events. ?

Read and write HTML elements. ?

Validate data before submitting it to the server. ?

Detect the browser information of visitors.

Control cookies, including creation and modification. ?

Server-side programming based on Node.js technology. ?