博主信息
博文 5
粉丝 0
评论 0
访问量 3635
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
1-明星相册
大蓓子的博客
原创
839人浏览过

<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
 <title>1.实战明星相册</title>
 <style type="text/css">
     .box {
      width: 500px;
      height: 700px;
      background-color: #efefef;
      border: 1px solid lightgray;
      margin: 20px auto;
      text-align: center;
      color: #636363;
      box-shadow: 2px 2px 2px #999;
     }

     .box ul {
      margin: 0;
      padding: 0;
      overflow: hidden;
     }

     .box ul li {
      float: left;
      list-style-type: none;
      margin-left: 20px;
      background-color: skyblue;
     }

     .box ul li a {
      display: block;
      width: 100px;
      height: 40px;
      line-height: 40px;
      color: white;
      text-decoration: none;
     }

     .box ul li a:hover {
      background-color: coral;
      font-size: 1.1em;
     }

     .box .pic {
      width: 450px;
      height: 470px;
      border: 1px solid lightgray;
      line-height: 1px;
      margin: auto;
      margin-top: 50px;
     }

     .box .pic img {
      width: 100%;
      height: 470px;
     }
 </style>
</head>
<body>
    <div class="box">
        <h2>明星相册</h2>
        <ul>
        <li><a href="images1/zly.jpg" title="《楚乔传》、《花千骨》..." onclick="changePic(this);return false;">赵丽颖</a></li>
        <li><a href="images1/gyy.jpg" title="《倚天屠龙记》、《爱无悔》..." onclick="changePic(this);return false;">高圆圆</a></li>
        <li><a href="images1/sl.jpg" title="《那年花开月正圆》、《玉观音》..." onclick="changePic(this);return false;">孙俪</a></li>
        <li><a href="images1/fbb.jpg" title="《还珠格格》、《我不是潘金莲》..." onclick="changePic(this);return false;">范冰冰</a></li>
        </ul>
        <div class="pic">
        <img src="images1/zwt.png" alt="" id="img">
        </div>
    <p id="info"></p>
    </div>
    <script type="text/javascript">
        function changePic(pic){
         // 获取一个明星图片和简介
         var picUrl = pic.href
         var picInfo = pic.title

         // 获取到要被替换掉的对象
         var img = document.getElementById('img')
         var p = document.getElementById('info')

         // 将对应的占位符对象进行替换
         img.src = picUrl
         p.innerHTML = picInfo

        }
    </script>
</body>
</html>



本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学