大娟
2017-01-02 11:05
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>图片上传下载1</title> <base href="<%=basePath%>"> <link rel="stylesheet" type="text/css" href="css/common.css" /> <script type="text/javascript" src="js/jquery-1.11.1.js" /> <script type="text/javascript"> $(function(){ $(".thumbs a").click(function(){ var largePath = $(this).attr("href"); var largeAlt = $(this).attr("title"); $("#largeImg").attr({ src:largePath, alt=largeAlt }); return false; }); }); </script> </head> <body> <h2>图片预览</h2> <p> <img id="largeImg" alt="Large Image" src="images/11.jpg"> </p> <p class="thumbs"> <a href="images/11.jpg" title="image1"> <img alt="" src="images/1.jpg"> </a> <a href="images/22.jpg" title="image2"> <img alt="" src="images/2.jpg"> </a> <a href="images/33.jpg" title="image3"> <img alt="" src="images/3.jpg"> </a> <a href="images/44.jpg" title="image4"> <img alt="" src="images/4.jpg"> </a> <a href="images/55.jpg" title="image5"> <img alt="" src="images/5.jpg"> </a> </p> </body> </html>
求在讲解,我还是默认在本页显示大图片
解决了,js写错了
src:largePath,
alt=largeAlt
alt:largeAlt
Java中的文件上传下载
77393 学习 · 337 问题
相似问题