实现根据后台绑定小图片,鼠标移至小图,自动显示相应大图
.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%>
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
暂无评论...
更新日志
2024年11月29日
2024年11月29日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]