无为清净楼资源网 Design By www.qnjia.com
实现根据后台绑定小图片,鼠标移至小图,自动显示相应大图
.Net精简版本
<script language="JavaScript">
function GetShowImg(imgfile)
{
document.all("ShowImage").src = "/semir/images/"+ imgfile;
}
</script>
//DataList绑定
<asp:datalist id="DlSides" runat="server" OnItemCommand="DlSides_ItemCommand" RepeatDirection="Horizontal"
RepeatColumns="3" DataKeyField="SideID" CssClass="semirText">
<ItemTemplate>
<a onmouseover="GetShowImg('<%# DataBinder.Eval(Container.DataItem, "sidePath")%>')"><IMG style="WIDTH: 45px; HEIGHT: 56px" alt="" src='/semir/images/small<%# DataBinder.Eval(Container.DataItem, "sidePath")%>' border=0 ></a>
</ItemTemplate>
</asp:datalist>
// 显示相应大图
<img name="ShowImage">
ASP完整版
<script language="JavaScript">
function ImagePreload()
{
var args = ImagePreload.arguments;
document.ImgPreArray = new Array(args.length);
for(var i=0; i<args.length; i++)
{
document.ImgPreArray[i] = new Image;
document.ImgPreArray[i].src = "admin/upfile/newbook/"+ args[i];
}
}
function fitSize() {
var a, b;
var imgobj = document.all("ShowImage");
var oldimg = new Image();
oldimg.src = imgobj.src;
var dw = oldimg.width;
var dh = oldimg.height;
if(imgobj == null) {
setTimeout("fitSize()", 50);
return;
}
if(imgobj.offsetWidth == 0) {
setTimeout("fitSize()", 50);
return;
}
var maxW = 300;
var maxH = 270;
if(dw>maxW || dh>maxH) {
a = dw/maxW;
b = dh/maxW;
if(b>a) a=b;
dw = dw/a;
dh = dh/a;
}
if(dw > 0 && dh > 0) {
imgobj.width = dw;
imgobj.height = dh;
}
}
function GetShowImg(imgtext, imgfile) {
document.all("ShowImgText").innerHTML = imgtext;
document.all("ShowImage").src = "admin/upfile/newbook/"+ imgfile;
document.all("ShowImage").width = 267;
document.all("ShowImage").height = 267;
//fitSize();'show picture size
}
function ShowTextDetail(n) {
for (i=1; i<5; i++) {
document.all("TextDetail"+i).style.display = "none";
}
document.all("TextDetail"+n).style.display = "";
for (i=1; i<4; i++) {
document.all("TitleDetail"+i).className = "shopTabOff";
}
if (n < 4) {
document.all("TitleDetail"+n).className = "shopTabOn";
}
}
</script>
<script language="JavaScript" for="window" event="onload">
ImagePreload('<%=rs("picture")%>');
</script>
'---------调用-显示-------
<%if rs("picture")<>"" then %>
<a style="cursor:hand">
<img name="ShowImage" src="admin/upfile/newbook/<%=rs("picture")%>" border="0" width="267" height="267">
<!-- <img name="ShowImage" src="../upimages/F_060524_000613_46398.jpg" border=0 onload="fitSize();"> -->
</a> <span id="ShowImgText" style="font-weight: bold;"></span>
<% end if %>
‘--------------鼠标移过的图片------
<% if rs("picture")<>"" then%>
<a onmouseover="GetShowImg('','<%=rs("picture")%>');">
<img name="Image71" src="admin/upfile/newbook/<%=rs("picture")%>" alt="dogo" width="40" height="30" border="0"></a>
<%end if%>
.Net精简版本
<script language="JavaScript">
function GetShowImg(imgfile)
{
document.all("ShowImage").src = "/semir/images/"+ imgfile;
}
</script>
//DataList绑定
<asp:datalist id="DlSides" runat="server" OnItemCommand="DlSides_ItemCommand" RepeatDirection="Horizontal"
RepeatColumns="3" DataKeyField="SideID" CssClass="semirText">
<ItemTemplate>
<a onmouseover="GetShowImg('<%# DataBinder.Eval(Container.DataItem, "sidePath")%>')"><IMG style="WIDTH: 45px; HEIGHT: 56px" alt="" src='/semir/images/small<%# DataBinder.Eval(Container.DataItem, "sidePath")%>' border=0 ></a>
</ItemTemplate>
</asp:datalist>
// 显示相应大图
<img name="ShowImage">
ASP完整版
<script language="JavaScript">
function ImagePreload()
{
var args = ImagePreload.arguments;
document.ImgPreArray = new Array(args.length);
for(var i=0; i<args.length; i++)
{
document.ImgPreArray[i] = new Image;
document.ImgPreArray[i].src = "admin/upfile/newbook/"+ args[i];
}
}
function fitSize() {
var a, b;
var imgobj = document.all("ShowImage");
var oldimg = new Image();
oldimg.src = imgobj.src;
var dw = oldimg.width;
var dh = oldimg.height;
if(imgobj == null) {
setTimeout("fitSize()", 50);
return;
}
if(imgobj.offsetWidth == 0) {
setTimeout("fitSize()", 50);
return;
}
var maxW = 300;
var maxH = 270;
if(dw>maxW || dh>maxH) {
a = dw/maxW;
b = dh/maxW;
if(b>a) a=b;
dw = dw/a;
dh = dh/a;
}
if(dw > 0 && dh > 0) {
imgobj.width = dw;
imgobj.height = dh;
}
}
function GetShowImg(imgtext, imgfile) {
document.all("ShowImgText").innerHTML = imgtext;
document.all("ShowImage").src = "admin/upfile/newbook/"+ imgfile;
document.all("ShowImage").width = 267;
document.all("ShowImage").height = 267;
//fitSize();'show picture size
}
function ShowTextDetail(n) {
for (i=1; i<5; i++) {
document.all("TextDetail"+i).style.display = "none";
}
document.all("TextDetail"+n).style.display = "";
for (i=1; i<4; i++) {
document.all("TitleDetail"+i).className = "shopTabOff";
}
if (n < 4) {
document.all("TitleDetail"+n).className = "shopTabOn";
}
}
</script>
<script language="JavaScript" for="window" event="onload">
ImagePreload('<%=rs("picture")%>');
</script>
'---------调用-显示-------
<%if rs("picture")<>"" then %>
<a style="cursor:hand">
<img name="ShowImage" src="admin/upfile/newbook/<%=rs("picture")%>" border="0" width="267" height="267">
<!-- <img name="ShowImage" src="../upimages/F_060524_000613_46398.jpg" border=0 onload="fitSize();"> -->
</a> <span id="ShowImgText" style="font-weight: bold;"></span>
<% end if %>
‘--------------鼠标移过的图片------
<% if rs("picture")<>"" then%>
<a onmouseover="GetShowImg('','<%=rs("picture")%>');">
<img name="Image71" src="admin/upfile/newbook/<%=rs("picture")%>" alt="dogo" width="40" height="30" border="0"></a>
<%end if%>
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
更新日志
2024年11月18日
2024年11月18日
- 费翔.2000-费常翔念2CD【环球】【WAV+CUE】
- Rachmaninoff-SuitesNos.12,TheSleepingBeauty-MikuOmine,TakakoTakahashi(2024)[24-
- 童丽《影视金曲(1:1黄金母盘版)》[WAV]
- 柏菲·胭花四乐《胭花四乐》限量开盘母带ORMCD[低速原抓WAV+CUE]
- 群星《监听耳机天碟》2018[WAV分轨][1G]
- 群星《娱协奖原创金曲合辑》滚石[WAV+CUE][1.1G]
- 罗大佑《美丽岛》2CD[WAV+CUE][1.1G]
- 言承旭.2009-多出来的自由【SONY】【WAV+CUE】
- 赤道.2000-精选2CD【ACM】【WAV+UCE】
- 许廷铿.2017-神奇之旅【华纳】【WAV+CUE】
- 李克勤《罪人》环球[WAV+CUE][1G]
- 陈粒2024《乌有乡地图》有此山文化[FLAC分轨][1G]
- 蔡依林《MYSELF》 奢华庆菌版 2CD[WAV+CUE][1.5G]
- 刘春美《心与心寻世界名曲中文版》新京文[低速原抓WAV+CUE]
- 朱逢博《蔷薇蔷薇处处开》[FLAC+CUE]