简单的图片库浏览页面

news/2024/10/17 10:27:40/

功能描述:

点击链接,使链接图片出现在页面下方。成为简单的图片库浏览页面。

代码实现:

//html代码
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>Image Gallery</title>  <link rel="stylesheet" type="text/css" href="styles/layout.css" media="screen">
</head>
<body><!-- 功能:点击链接,使链接图片出现在页面下方。成为简单的图片库浏览页面 --><h1>Snapshots</h1><ul id="imagegal">	<li><a href="Image/rose.jpg" onclick="showPic(this);return false" title="rose Image">rose Image</a></li><li><a href="Image/bird.jpg" onclick="showPic(this);return false" title="bird Image">bird Image</a></li><li><a href="Image/shanghai.jpg" onclick="showPic(this);return false" title="shanghai Image">shanghai Image</a></li><li><a href="Image/beautifulrose.jpg" onclick="showPic(this);return false" title="beautifulrose Image">beautifulrose Image</a></li><img id="placeholder" src="Image/gallery.jpg"><p id="description">Choose an image</p></ul>
</body><script type="text/javascript" src="scripts/showPic.js"></script>
</html>

CSS代码

body{ font-family: "Helvetica","Arial",serif;color: #333;background-color: #ccc;margin: 1em 10%;
}h1{color: #333;background-color: transparent;
}a{color: #008000;background-color: transparent;font-weight: bold;text-decoration: none;
}ul{padding: 0;
}li{float: left;padding: 1em;list-style: none;
}img{display: block;clear: both
}

JS代码

function showPic(whichPic){var num1=whichPic.getAttribute("href");var placeholder=document.getElementById("placeholder");placeholder.setAttribute("src",num1);var titleNume2=whichPic.getAttribute("title");var description=document.getElementById("description");/*注:将titleNume2的值赋值给descriptionText将titleNume2直接赋值给description.innerText是不一样的*///var descriptionText=description.innerText;//descriptionText=titleNume2;// 下面这两种方式都可以实现P标签里的内容替换//description.innerText=titleNume2;description.firstChild.nodeValue=titleNume2;	}

 

 

 

 


http://www.ppmy.cn/news/150224.html

相关文章

浏览器图片链接直接下载图片二不是预览

接口设置&#xff1a;response.setHeader(“Content-Disposition”, “attachment; filename111.jpg”); 图片链接&#xff1a;http://imgstore03.cdn.sogou.com/v2/thumb/dl/79b1f86314173525f19c10a191e91745.jpg?appid10150005&refererhttp://pic.sogou.com&urlht…

Web简易图片浏览器

实现功能&#xff1a;旋转、拖拽、鼠标滚轮放大缩小 样式 .img-viewer {overflow: hidden;height: 0;padding-bottom: 75%;;}.iv-btn-area {display: flex;flex-direction: row;justify-content: center;}.iv-btn-area button {width: 3rem;height: 3rem;font-size: 1.2rem;mar…

选择浏览图片

我们先看到前端 放置图片的地方写上x:Name 名作为后端需要时可以找到该位置 浏览路径的文本一样 还需要浏览按钮&#xff0c;清空要不要都行 那么接下来的就是后端的操作 对了还有下面的这个初始化&#xff0c;写在在外头 List<byte[]> lstBytes new List<byte[]&…

使用浏览器插件,下载网页中的图片

1.360浏览器。 在扩展中搜索图片下载&#xff0c;点击安装此插件 提取网页图片时&#xff0c;只需点击浏览器右上角的图标 2.谷歌浏览器 下载 Image downloader Chrome插件 http://www.cnplugins.com/photos/imageye-image-downloader/ 安装方法 https://jingyan.baidu.c…

(HoneyView)轻便好用的免费图片浏览器

需求 windows 10 自带的图片浏览器加载图片总是很慢&#xff0c;这在整理照片的时候就显得特别不方便。因此&#xff0c;想找一个免费的、轻巧的、快速的图片浏览器&#xff0c;来替代掉 windows 10自带的图片浏览器。 解决方案&#xff1a;HoneyView 下载地址 Bandisoft - H…

Chrome浏览器保存整个网页为图片的方法

Chrome浏览器保存整个网页为图片的方法 方法举例说明 方法 打开需要保存为图片的网页 然后按F12&#xff0c;接着按CtrlShiftP 在红框内输入full 举例说明 以这个网址的网站为里&#xff0c;vitesse产品的各种型号&#xff1a; https://www.microsemi.com/product-directory…

android图片浏览器(一)

主要实现的功能就是浏览图片。 用到的控件&#xff1a;ImageSwitcher和Gallery。 这种简单的图片浏览器google一下有很多&#xff0c;我也是参考别人上写的。在搜索的过程中&#xff0c;我发现了一个比较有意思的事情&#xff0c;就是很多博客里面的代码基本上都是相同的&…

基于RecyclerView的图片浏览器

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 前言一、作业要求二、具体实现1.布局代码2.程序代码 总结 前言 基于RecyclerView的图片浏览器 一、作业要求 使用RecyclerView实现一个图片列表&#xff0c;如图…