js+css打造漂亮的网页相册显示效果,当用户点击上面的小图后在下面直接显示大图,实用相册图片展示程序代码。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren"> <meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。"> <title>经典实用的网页漂亮相册特效分享_武鸣人</title> <style> *{ margin:0; padding:0; list-style:none} body{ font-family:Arial, Helvetica, sans-serif; font-size:12px; line-height:1.8;} img{ display:block; border:0;} h1,h2{ background:#85B829; line-height:2.5; font-size:14px; padding-left:10px; color:#fff;} #www_wuming_ren{ border-left:3px solid #468C50; border-right:3px solid #99CC99; background:#B5DF63; float:left; width:750px;} li{ float:left;} a{ display:block; background:#fff; border:1px solid #A4D742; text-align:center; color:#598628; text-decoration:none; padding:5px; margin:10px;} a:hover,a:active{ background:#99CC33; border:1px solid #85B829; border-left:1px solid #fff; border-top:1px solid #fff; color:#fff} #showpic{ border:1px solid #85B829; padding:5px; display:none; clear:left; background:#FFF; text-align: center} ul,#showpic{ margin:10px;} h2{ color:#598628; background:none; text-align:left} #showpic img{ margin:auto} </style> </head> <body> <a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr> <!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。--> <script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script> <script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script> <div id="www_wuming_ren"> <h1>武鸣人相册系统</h1> <ul> <li><a href="/img/20240516_www_wuming_ren_12.jpg" title="四只长颈鹿"><img src="/img/20240516_www_wuming_ren_22.jpg" />长颈鹿</a></li> <li><a href="/img/20240516_www_wuming_ren_13.jpg" title="绿色的小青蛙"><img src="/img/20240516_www_wuming_ren_23.jpg" />青蛙</a></li> <li><a href="/img/20240516_www_wuming_ren_14.jpg" title="小狗狗会汪汪"><img src="/img/20240516_www_wuming_ren_24.jpg" />小狗狗</a></li> <li><a href="/img/20240516_www_wuming_ren_15.jpg" title="小老鼠兄弟"><img src="/img/20240516_www_wuming_ren_25.jpg" />鼠小弟</a></li> <li><a href="/img/20240516_www_wuming_ren_16.jpg" title="烫发的白天鹅"><img src="/img/20240516_www_wuming_ren_26.jpg" />白天鹅</a></li> <li><a href="/img/20240516_www_wuming_ren_17.jpg" title="鹦鹉夫妇"><img src="/img/20240516_www_wuming_ren_27.jpg" />鹦鹉</a></li> <li><a href="/img/20240516_www_wuming_ren_18.jpg" title="北方的狼 武鸣人"><img src="/img/20240516_www_wuming_ren_28.jpg" />狼</a></li> <li><a href="/img/20240516_www_wuming_ren_19.jpg" title="警觉中的斑马"><img src="/img/20240516_www_wuming_ren_29.jpg" />斑马</a></li> <li><a href="/img/20240516_www_wuming_ren_20.jpg" title="绿色的鸟"><img src="/img/20240516_www_wuming_ren_30.jpg" />绿色的鸟</a></li> <li><a href="/img/20240516_www_wuming_ren_21.jpg" title="金黄色的小金鱼"><img src="/img/20240516_www_wuming_ren_31.jpg" />小金鱼</a></li> </ul> </div> <script language="javascript"> function setDiv(){ var www_wuming_ren = document.getElementById("www_wuming_ren"); var showpic = document.createElement("div"); showpic.setAttribute("id", "showpic"); www_wuming_ren.appendChild(showpic); showpic.appendChild(document.createElement("h2")); showpic.appendChild(document.createElement("img")); var links = www_wuming_ren.getElementsByTagName("a"); for(var k=0; k<links.length; k++){ links[k].onclick = function(){ return showPic(this); }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) } } function showPic(pic){ var showpic = document.getElementById("showpic"); showpic.style.display = "block"; showpic.getElementsByTagName("h2")[0].innerHTML = pic.title; showpic.getElementsByTagName("img")[0].setAttribute("src", pic.href); return false; }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) window.onload = setDiv; </script> </body> </html>
本文来自武鸣人网站,转载请注明出处