Home >Web Front-end >JS Tutorial >How to dynamically switch pictures in js_javascript skills

How to dynamically switch pictures in js_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:19:071266browse

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:

Copy code The code 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:

Copy code The code is as follows:
 
 
 
     
    js,css动态切换图片 
     
     
 
 
   
 
         
       
     
               
  • 1
  •  
               
  • 2
  •  
               
  • 3
  •  
           
 
   
 
 

I hope this article will be helpful to everyone’s JavaScript programming design.

Statement:
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