The example in this article describes the method of dynamically switching pictures in js. Share it with everyone for your reference. The specific implementation method is as follows:
The index.css file is as follows:
* {
margin: 0px;padding: 0px;
}
body {
Width: 632px;
/*background-color: blue;*/
margin: 0 auto;
}
#imgsCom {
background-color: yellow;
/*Relative positioning, in order to use absolute positioning for the lower layer, use the origin of this div as the origin*/
Position: relative;
}
#ulnav{
List-style-type: none;
position: absolute;
/*Use imgsCom as the origin to absolutely position the lower right corner*/
bottom: 0px;
Right: 0px;
}
#ulnav li{
List-style-type: none;
float: left;
background-color: black;
color: white;
margin-right: 5px;
Width: 20px;
Height: 20px;
Line-height: 20px;
Text-align: center;
Cursor: pointer;
}
index.html is as follows:
I hope this article will be helpful to everyone’s JavaScript programming design.