刚刚把层显示做出来了,但始终不会在层里显示该图的大图片,我应该怎么做啊?各位大哥帮帮忙啊~~~
<table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<%
set rs=server.createobject("adodb.recordset")
if nclassid="" then
rs.open "select * from xr_products where anclassid="&anclassid&" order by ding desc,orderdate desc",conn,1,1
else
rs.open "select * from xr_products where anclassid="&anclassid&" and nclassid="&nclassid&" order by ding desc,orderdate desc",conn,1,1
end if
if rs.recordcount=0 then
%>
<td><table width="100%" border="0" cellspacing="0" cellpadding="5" align="center">
<tr>
<td align=center><b>Sorry, does not have the product classification temporarily! </b></td>
</tr>
</table>
</td>
<%
else
rs.PageSize =12
if not isnumeric(Request("Page")) then
Page=1
else
Page = Clng(Request("Page"))
end if
If Page < 1 Then Page = 1
If Page > rs.PageCount Then Page = rs.PageCount
rs.AbsolutePage = Page
pagecount1=rs.pagecount
recordcount1=rs.recordcount
i=1
while not rs.eof and i<=rs.pagesize
%>
<td align="center">
<table border=0 cellpadding=2 cellspacing=0>
<tr>
<td align=center style="padding-top:10px"><SPAN style="CURSOR: hand" onclick=Show(xk_poplod)><a href="#"><img src="../<%=trim(rs("productpic"))%>" alt="Product picture" width="120" height="120" border="0" style="border: 0px solid #eeeeee"></a></SPAN></td>
</tr>
<tr>
<td align=center><a href=list.asp?id=<%=rs("productid")%>&nid=<%=rs("nclassid")%> class="url1"><%=left(trim(rs("eproductname")),25)%></a></td>
</tr>
</table>
</td>
<%rs.movenext
if i mod 6=0 then response.Write("</tr><tr>")
i=i+1
wend
end if
rs.close
set rs=nothing%>
<%
rs1.movenext
wend
end if
rs1.close
set rs1=nothing
%>
</tr>
</table>
div id=xk_poplod style="FILTER: revealTrans(transition=12,duration=0.5) blendTrans(duration=0.5); POSITION: absolute; visibility: hidden; left:35%; top:35%; height: 200; width: 200;">
<table width="270" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFCC">
<tr>
<td><img src="../<%=trim(rs("productpic"))%>"></td>
</tr>
<tr>
<td> <div align=right><span style="CURSOR: hand"
onClick=Hide(xk_poplod)>关 闭</span></div></td>
</tr>
</table>
</div>
<table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<%
set rs=server.createobject("adodb.recordset")
if nclassid="" then
rs.open "select * from xr_products where anclassid="&anclassid&" order by ding desc,orderdate desc",conn,1,1
else
rs.open "select * from xr_products where anclassid="&anclassid&" and nclassid="&nclassid&" order by ding desc,orderdate desc",conn,1,1
end if
if rs.recordcount=0 then
%>
<td><table width="100%" border="0" cellspacing="0" cellpadding="5" align="center">
<tr>
<td align=center><b>Sorry, does not have the product classification temporarily! </b></td>
</tr>
</table>
</td>
<%
else
rs.PageSize =12
if not isnumeric(Request("Page")) then
Page=1
else
Page = Clng(Request("Page"))
end if
If Page < 1 Then Page = 1
If Page > rs.PageCount Then Page = rs.PageCount
rs.AbsolutePage = Page
pagecount1=rs.pagecount
recordcount1=rs.recordcount
i=1
while not rs.eof and i<=rs.pagesize
%>
<td align="center">
<table border=0 cellpadding=2 cellspacing=0>
<tr>
<td align=center style="padding-top:10px"><SPAN style="CURSOR: hand" onclick=Show(xk_poplod)><a href="#"><img src="../<%=trim(rs("productpic"))%>" alt="Product picture" width="120" height="120" border="0" style="border: 0px solid #eeeeee"></a></SPAN></td>
</tr>
<tr>
<td align=center><a href=list.asp?id=<%=rs("productid")%>&nid=<%=rs("nclassid")%> class="url1"><%=left(trim(rs("eproductname")),25)%></a></td>
</tr>
</table>
</td>
<%rs.movenext
if i mod 6=0 then response.Write("</tr><tr>")
i=i+1
wend
end if
rs.close
set rs=nothing%>
<%
rs1.movenext
wend
end if
rs1.close
set rs1=nothing
%>
</tr>
</table>
div id=xk_poplod style="FILTER: revealTrans(transition=12,duration=0.5) blendTrans(duration=0.5); POSITION: absolute; visibility: hidden; left:35%; top:35%; height: 200; width: 200;">
<table width="270" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFCC">
<tr>
<td><img src="../<%=trim(rs("productpic"))%>"></td>
</tr>
<tr>
<td> <div align=right><span style="CURSOR: hand"
onClick=Hide(xk_poplod)>关 闭</span></div></td>
</tr>
</table>
</div>
你后台语言去 ASP那问
<div id='smallPic'><img src="换成你的图片路径" border="0" width=30,height=30 onclick='javascript:ImgSizeChange(this);'></div>
<div id='modifiedPic' style='position:absolute;display:none' onclick='javascript:ImgRestore(this);'></div>
<script language="javascript">
function ImgSizeChange(o){
var obj=document.getElementById("smallPic");var sHTML='';
obj.style.display='none'; obj=document.getElementById("modifiedPic");
sHTML="<img src='"+o.src+"' width='800' height='600' border=0 alt='放大图'>"
obj.innerHTML=sHTML;
obj.style.display=''
} function ImgRestore(o){
o.style.display='none';
var oo=document.getElementById("smallPic");
oo.style.display='';
}
</script>
其实我给你的是一个思路,已经基本符合你的需求了,稍加改动就可以了'读库显示小图片
'....
while not rs.eof and i <=rs.pagesize
%>
<td align="center">
<table border=0 cellpadding=2 cellspacing=0>
<tr>
<td align=center style="padding-top:10px">
<a href="#"> <img src="../<%=trim(rs("productpic"))%>" alt="Product picture" width="120" height="120" border="0" style="border: 0px solid #eeeeee" onclick='javascript:ImgSizeChange(this);'> </a>
</td>
</tr>
<tr>
<td align=center> <a href=list.asp?id= <%=rs("productid")%>&nid= <%=rs("nclassid")%> class="url1"> <%=left(trim(rs("eproductname")),25)%> </a> </td>
</tr>
</table>
</td>
<%rs.movenext
if i mod 6=0 then response.Write(" </tr> <tr>")
i=i+1
wend
'.....
%>
............
<!--大图层容器-->
<div id=xk_poplod style="FILTER: revealTrans(transition=12,duration=0.5) blendTrans(duration=0.5); POSITION: absolute; visibility: hidden; left:35%; top:35%; height: 200; width: 200;" onclick="javascript:this.style.display='none'"></div>
<!--脚本-->
<script language="javascript">
function ImgSizeChange(o){
var sHTML='';
obj=document.getElementById("xk_poplod");
sHTML="<img src='"+o.src+"' border=0 alt='"+o.alt+"'>"
obj.innerHTML=sHTML;
obj.style.display=''
}
</script>
其实我看了你的代码,知道那个是可以把图像变大的,但我一用到通过库读取的图像,那个层就显示不出来了,就是在<img>里面加onclick就显示不出来.在普通的图片里面那个层就可以显示.而我试过的就是在图那里加<SPAN style="CURSOR: hand" onclick=Show(xk_poplod)></SPAN>那个层才能显示.
昨天我就按照你那样做做得跟你第二词回帖那样,但不能显示,今天看到你的回帖我把它覆盖我昨晚做的,结果还是没有显示.
浪费你这么多精神不好意思了,但能麻烦你再花多一点时间帮帮我吗?谢谢!
#demo{overflow:hidden;width:120px;text-align:center;padding:10px;}
#demo img{border:none;width:100px;height:100px;border:5px solid #f4f4f4}
#enlarge_images{position:absolute;display:none;z-index:2;border:5px solid #f4f4f4}
</style>
<div id="demo" style="overflow:hidden;width:120px;text-align:center;padding:10px">
<img src="image/1.jpg">
</div>
<div id="enlarge_images"></div>
<script>
var demo = document.getElementById("demo");
var gg = demo.getElementsByTagName("img");
var ei = document.getElementById("enlarge_images");
for(i=0; i<gg.length; i++){
var ts = gg[i];
ts.onclick = function(event){
event = event || window.event;
ei.style.display = "block";
ei.innerHTML = '<img src="' + this.src + '" />';
ei.style.top = document.body.scrollTop + event.clientY + 10 + "px";
ei.style.left = document.body.scrollLeft + event.clientX + 10 + "px";
}
ts.onmouseout = function(){
ei.innerHTML = "";
ei.style.display = "none";
}
}
</script>
我也试过用这种,但只能显示每页的第一张图片的原始图
<td align=center style="padding-top:10px">
<span style="cursor:hand" title="点击看大图"><img src="../<%=trim(rs("productpic"))%>" alt="Product picture" width="120" height="120" border="0" onclick='javascript:ImgSizeChange(this);'></span>
</td>
试一下