/* *使用方法 *
<img src='http://upload.sj63.com/demo/Contentstop/1111/255(84).jpg' border='0' />
* * *註:凡是在include此頁面後的頁面,只要圖片有 alt 屬性,都會有彈出式視窗. include方式: */ var pltsPop=null; var pltsoffsetX = 0; // 彈出視窗與Mouse左或右的距離 (3~12較合適) var pltsoffsetY = 0; // 彈出視窗與Mouse上或下的距離 (3~12較合適) var pltsTitle=""; document.write(''); function pltsinits() { document.onmouseover = plts; document.onmousemove = moveToMouseLoc; } function plts() { var o=event.srcElement; if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.alt=""}; if(o.title!=null && o.title!=""){o.dypop=o.title;o.title=""}; pltsPop=o.dypop; //if(pltsPop!=null&&pltsPop!=""&&typeof(pltsPop)!="undefined") if(pltsPop!=null&&pltsPop!=""&&typeof(pltsPop)!="undefined"&&(event.srcElement.id=="smallpic" || event.srcElement.id=="bigpic")) { pltsTipLayer.style.left=-1000; pltsTipLayer.style.display=''; var Msg=pltsPop.replace(/\n/g,"
"); Msg=Msg.replace(/\0x13/g,"
"); var re=/\{(.[^\{]*)\}/ig; if(!re.test(Msg))pltsTitle="已上傳圖片"; else{ re=/\{(.[^\{]*)\}(.*)/ig; pltsTitle=Msg.replace(re,"$1")+" "; re=/\{(.[^\{]*)\}/ig; Msg=Msg.replace(re,""); Msg=Msg.replace("
","");} var content = '
'+ ''+ ''+ ''+ '

'+pltsTitle+'

'+Msg+'
'; pltsTipLayer.innerHTML=content; toolTipTalbe.style.width=Math.min(pltsTipLayer.clientWidth,document.body.clientWidth/2.2); moveToMouseLoc(); return true; } else { pltsTipLayer.innerHTML=''; pltsTipLayer.style.display='none'; return true; } } function moveToMouseLoc() { if(pltsTipLayer.innerHTML=='')return true; var MouseX=event.x; var MouseY=event.y; var popHeight=pltsTipLayer.clientHeight; //另開視窗的高度 var popWidth=pltsTipLayer.clientWidth; //另開視窗的寬度 pltsTipLayer.style.left=MouseX + pltsoffsetX ; //另開視窗x座標 if (event.srcElement.id=="smallpic"){ //判斷目前滑鼠移至的圖片是那一張 //pltsTipLayer.style.top=Label1.offsetTop - popHeight + pltsoffsetY; //另開視窗y座標 (若不使用masterpage時) pltsTipLayer.style.top=ctl00_ContentPlaceHolder1_Label1.offsetTop - popHeight + pltsoffsetY; //另開視窗y座標 (若將include檔放在masterpage時) }else if(event.srcElement.id=="bigpic"){ //pltsTipLayer.style.top=Label2.offsetTop - popHeight + pltsoffsetY; //另開視窗y座標 (若不使用masterpage時) pltsTipLayer.style.top=ctl00_ContentPlaceHolder1_Label2.offsetTop - popHeight + pltsoffsetY; //另開視窗y座標 (若將include檔放在masterpage時) } return true; } pltsinits(); /* parseInt(event.clientY)+parseInt(document.body.scrollTop); //取得滑鼠的絕對座標 window.screen.width==螢幕寬度 window.screen.availWidth==螢幕寬度-工具列寬度(EX:office快捷列) window.screen.height==螢幕高度 window.screen.availHeight==螢幕高度-工具列高度(EX:開始列) document.body.clientWidth==文件寬度-scrollbar(上下拉)寬度 document.body.offsetWidth==文件寬度 document.body.clientHeight==文件高度-scrollbar(左右拉)高度 document.body.offsetHeight==文件高度 document.body.scrollWidth==文件scrollbar(左右拉)總寬度 document.body.scrollHeight==文件scrollbar(上下拉)總高度 event.screenY pltsTipLayer.style.left=MouseX+pltsoffsetX+document.body.scrollLeft+popLeftAdjust; pltsTipLayer.style.top=MouseY+pltsoffsetY+document.body.scrollTop+popTopAdjust; pltsTipLayer.style.top=588-popHeight; pltsTipLayer.style.top=MouseY-popHeight+(document.body.clientHeight-MouseY); alert(event.srcElement.id); */