我有图片的路径,如下图所示:图片src使用jQuery
<img src='Uploads/" + document.getElementById("<%=currentDirectory.ClientId%>").value + "/" + file.name + "' width='70' height='55'/>
,现在我想,以显示其原单图像点击这个缩略图。 对于我做这样的:
$(".imgContain").click(function() {
$('#<%=largeImage.ClientId%>').attr('src','Uploads/" + document.getElementById("<%=currentDirectory.ClientId%>").value + "/" + file.name + "');
});
当我做到这一点的方式,并检查其SRC它显示我为“无法加载给URL”。 任何人都可以编辑我这个src或指出我哪个是最好的方法来做到这一点?
这是我的HTML部分:
<div id="thumbs" class="imgContain" runat="server">
</div>
<asp:Image ID="largeImage" runat="server"
style="position:relative;width:450px;height:345px; margin-left:430px;margin-top:-415px; margin-bottom:30px;"
BorderColor="#666666" BorderStyle="Dashed" BorderWidth="4px"/>
是你的任何机会在外部文件的JavaScript? – 2012-02-05 00:09:52
@ Mikey-No它在主脚本内 – coder 2012-02-05 00:10:59
您可以向我们展示实际生成的HTML而不是您的ASP代码。我们不知道实际上在页面中放置了什么,因此我们不知道实际运行的代码(您可能不知道)。在浏览器中获取实际生成的代码的地方是View/Source。 – jfriend00 2012-02-05 00:14:55