📄 showimg.js
字号:
var showFlag = false;
var oldelm1;
var timeElm ;
function showBigImg(image, id, event)
{
if(navigator.userAgent.indexOf("Firefox")>0) //是Firefox浏览器
{
showBigImgFF(image, id, event);
}
else //包括微软在内的使用
{
showBigImgMS(image, id);
}
//if(isFirefox=navigator.userAgent.indexOf("Firefox")>0)return 2;
}
function showBigImgMS(image, id)
{
var elm1 = window.event.srcElement;
showFlag = true;
var beginShow = function() {BeginShow(elm1, image, id);}
//alert(1);
timeElm = window.setTimeout(beginShow, 550);
}
function BeginShow(elm1, image, id)
{
//var elm2 = window.event.srcElement;
if( showFlag)
{
ShowInfo(elm1, image, id);
}
}
function ShowInfo(elm1, image, id)
{
//<img src="images/head_01.jpg" />
if(elm1 !=oldelm1)
{
RemoveElm('imgpanel');
var str = '<div style="position:absolute; z-index:10 ;" id=imgpanel>';
str += '<div style="position:absolute; border:#666666 1px solid; z-index:10 ;left:-4px;top:-10px ">';
str +='<div style=" border:#E8E8E8 5px solid; padding:15px ; background-color:#FFFFFF ">';
str +='<div style=" border:#B6B6B6 2px solid; " id=imgArea>';
str +='<img src="product_image/' + image + '" id="num_' + id + '" /></div></div>';
str +='<img src="js/arra.gif" style="position:absolute; z-index:2 ; left:-10px;top:12px" />';
str +='</div></div>';
var parentElm = elm1.parentNode;
if(parentElm)
{
parentElm.innerHTML+=str;
}
var a = new Image();
a.onload = function(){ var elm = document.getElementById("num_"+id); if(elm){elm.src = a.src}}
a.src = "product_image/" + image;
oldelm1 = elm1;
}
else
{
}
}
function RemoveElm(elmId)
{
try
{
var elm = document.getElementById(elmId);
if(elm)elm.parentNode.removeChild(elm);
}
catch(e)
{
//alert('RemoveEml' + e.description);
}
}
function mouseout(image)
{
try
{
RemoveElm('imgpanel');
if(timeElm)
{
window.clearTimeout(timeElm);
}
}
catch(e)
{
//alert('RemoveEml' + e.description);
}
}
//-----------FF浏览器调用
function showBigImgFF(image, id, event)
{
var elm1 = event.target;
showFlag = true;
var beginShow = function() {BeginShowFF(elm1, image, id);}
//alert(1);
timeElm = window.setTimeout(beginShow, 550);
}
function BeginShowFF(elm1, image, id)
{
//var elm2 = window.event.srcElement;
if( showFlag)
{
ShowInfoFF(elm1, image, id);
}
}
function ShowInfoFF(elm1, image, id)
{
//<img src="images/head_01.jpg" />
if(elm1 !=oldelm1)
{
RemoveElm('imgpanel');
var str = '<div style="position:absolute; z-index:10 ;" id=imgpanel>';
str += '<div style="position:absolute; border:#666666 1px solid; z-index:10 ;left:80px;top:-70px ">';
str +='<div style=" border:#E8E8E8 5px solid; padding:15px ; background-color:#FFFFFF ">';
str +='<div style=" border:#B6B6B6 2px solid; " id=imgArea>';
str +='<img src="product_image/' + image + '" id="num_' + id + '" border="0" /></div></div>';
str +='<img src="js/arra.gif" style="position:absolute; z-index:2 ; left:-10px;top:12px" border="0" />';
str +='</div></div>';
var parentElm = elm1.parentNode;
if(parentElm)
{
parentElm.innerHTML+=str;
}
var a = new Image();
a.onload = function(){ var elm = document.getElementById("num_"+id); if(elm){elm.src = a.src}}
a.src = "2/" + image;
oldelm1 = elm1;
}
else
{
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -