1. kode js
Copy kode kodenya sebagai berikut:
//******************Definisi pengaturan default.************************
tPopWait=50;//Tampilkan prompt setelah berada di tWait selama milidetik.
tPopShow=5000;//Tutup perintah setelah menampilkan tShow selama milidetik
tampilkanPopLangkah=20;
popOpacity=99;
//******************Definisi variabel internal******************
sPop=batal;
pertunjukan saat ini=null;
tFadeOut=batal;
tFadeIn=batal;
tFadeWaiting=null;
document.write("<mce:style type='text/css'id='defaultPopStyle'><!--
");
document.write(".cPopText { line-break : normal;word-break : break-all ; warna latar: #FEFCF3;warna:#000000; batas: 1px #E7B68C solid;padding-top: 2px; padding-kanan : 4px; bantalan-kiri: 4px; bantalan-bawah: 2px; 12 piksel; lebar: 96 piksel; filter: Alfa(Opasitas=0)}");
dokumen.tulis("
--></mce:style><style type='text/css'id='defaultPopStyle' mce_bogus="1">");
document.write(".cPopText { line-break : normal;word-break : break-all ; warna latar: #FEFCF3;warna:#000000; batas: 1px #E7B68C solid;padding-top: 2px; padding-kanan : 4px; bantalan-kiri: 4px; bantalan-bawah: 2px; 12 piksel; lebar: 96 piksel; filter: Alfa(Opasitas=0)}");
dokumen.write("</style>");
document.write("<div id='dypopLayer' style="position:absolute;z-index:1000;" mce_style="position:absolute;z-index:1000;" class='cPopText'></div> ");
fungsi showPopupText(){
var o=acara.srcElement;
MouseX=acara.x;
MouseY=acara.y;
if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.alt=""};
if(o.title!=null && o.title!=""){o.dypop=o.title;o.title=""};
if(o.dypop!=sPop) {
sPop=o.dypop;
clearTimeout(curShow);
clearTimeout(tFadeOut);
clearTimeout(tFadeIn);
clearTimeout(tFadeWaiting);
if(sPop==null || sPop=="") {
dypopLayer.innerHTML="";
dypopLayer.style.filter="Alpha()";
dypopLayer.filters.Alpha.opacity=0;
}
kalau tidak {
if(o.dyclass!=null) popStyle=o.dyclass
lain popStyle="cPopText";
curShow=setTimeout("showIt()",tPopWait);
}
}
}
fungsi tampilkan(){
dypopLayer.className=popStyle;
dypopLayer.innerHTML=sPop;
popWidth=dypopLayer.clientWidth;
popHeight=dypopLayer.clientHeight;
if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24
lain popLeftAdjust=0;
if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24
lain popTopAdjust=0;
dypopLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;
dypopLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;
dypopLayer.style.filter="Alpha(Opacity=0)";
fadeOut();
}
fungsi fadeOut(){
if(dypopLayer.filters.Alpha.opacity<popOpacity) {
dypopLayer.filters.Alpha.opacity+=showPopStep;
tFadeOut=setTimeout("fadeOut()",1);
}
kalau tidak {
dypopLayer.filters.Alpha.opacity=popOpacity;
tFadeWaiting=setTimeout("fadeIn()",tPopShow);
}
}
fungsi fadeIn(){
if(dypopLayer.filters.Alpha.opacity>0) {
dypopLayer.filters.Alpha.opacity-=1;
tFadeIn=setTimeout("fadeIn()",1);
}
}
document.onmouseover=tampilkanPopupTeks;
2. Kode html hanya perlu berisi kode js, contoh penggunaan
<a href="../UpLoadFile/200911784060017.jpg" target="_blank">Besar</a><a href="../UpLoadFile/200911784060018.jpg" target="_blank">Kecil</a>