JavaScript实现同一个页面打开多张图片

坚持就是胜利。胜利不重要,重要的是能坚持人生最大的哀痛,是子欲孝而亲不在!人生最大的悲剧,是家未富而人先亡,人生最大的可怜,是弥留之际才明白自己是应该做什么的!

我们的目标是:


代码:

<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
<title>js美术馆</title> 
<script type="text/javascript" > 
 function showPic(whichpic) 
 { 
  var source=whichpic.getAttribute("href"); 
  var placeholder= document.getElementById("placeholder"); 
  placeholder.setAttribute("src",source); 
 } 
</script> 
<style> 
 .wrap{ 
  width:1000px; 
  margin:0 auto; 
  } 
 
 .place{ 
  margin:0 auto; 
  text-align:center; 
  } 
  .table{ 
  width:1000px; 
  height:27px; 
  margin-bottom:10px; 
  } 
  .table li{ 
  float:left; 
  line-height:27px; 
  list-style-type: none; 
  width: 100px; 
  font-family: "微软雅黑"; 
  text-align: center; 
  } 
</style> 
<body> 
<div class="wrap"> 
<h1>Snapshots</h1> 
<div class="table"> 
<ul> 
 <li> 
  <a rel="nofollow noopener noreferrer" href="images/网站1.jpg" onclick="showPic(this);return false;" title="A display">第一个</a> 
 </li> 
 <li> 
  <a rel="nofollow noopener noreferrer" href="images/网站2.jpg" onclick="showPic(this);return false;" title="B display">第二个</a> 
 </li> 
 <li> 
  <a rel="nofollow noopener noreferrer" href="images/网站3.jpg" onclick="showPic(this);return false;" title="C display">第三个</a> 
 </li> 
 <li> 
  <a rel="nofollow noopener noreferrer" href="images/网易.PNG" onclick="showPic(this);return false;" title="D display">第四个</a> 
 </li> 
 <li> 
  <a rel="nofollow noopener noreferrer" href="images/MOOC中国.PNG" onclick="showPic(this);return false;" title="E display">第五个</a> 
 </li> 
</ul> 
</div> 
//添加一个占位符 
<div class="place"> 
<img id="placeholder" src="images/ad.jpg" alt="my image" /> 
</div> 
<!--place end--> 
</div> 
<!--wrap end--> 
</body> 
</html> 

效果如下:


以上就是JavaScript实现同一个页面打开多张图片。这个时代传奇的男女,必要经历许多分分合合,辜负过很多人、也被很多人辜负过,然后在世人的议论纷纷中永垂不朽。扛得住诋毁,才担得起成功。经得起流言,才写得出传奇。更多关于JavaScript实现同一个页面打开多张图片请关注haodaima.com其它相关文章!

标签: 多张 JavaScript