Mata Pisau

Swap Image pada Web

Posted on: Januari 18, 2008

apa itu swap image? harafiah nya seee mereplace image … halah! mengganti image dengan image yang lain … ngunu weee kok angil … nah contohnya kayak dibawah neee

link.gif

swap1.gif

nah yang disebut swap image ntu yang kalo pas mousenya ada di image yang dimaksud maka imagenya jadi berubah, kayak kalo teman mau meratiin ya tulisan galeri ma bunga-bunga diatas berubah karena mos nya baru ada di tulisan galerinya ntu, buat mbuat kayak gitu pertama ne taruh script ini dulu :

“<script language=”JavaScript” type=”text/JavaScript”>
<!–
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf(“#”)!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf(“?”))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//–>
</script>

tanpa tanda petik didepan dan dibelakang kata script taruh didalam head
kemudian pada image yang dilink ditambahin perintah swap image kayak gini :

” <a onMouseOut=”MM_swapImgRestore()” onMouseOver=”MM_swapImage(‘Image2′,”,’images/link_2.gif’,1)” href=”index.htm”>

<img border=”0″ src=”images/link_02.gif” name=”Image2″ width=”150″ height=”60″></a>

tanpa tanda petik didepan dan dibelakang script
contoh diatas mengganti image link_02.gif menjadi link_2.gif saat mos berada di image link_02.gif
yang perlu diperhatikan adalah nama imagenya antara link ato swaping ma image yang asli harus sama

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

Sekedar Pikiran

one of my friends used to say "there is an evil side in everyone's life", but for me, i think, i had more than one, i had some evil side inside me. The evil that doing this, one evil that doing those, one more that was here, and some more was there ...
sometimes i get confuse with what I've did, confuse whether it was right or wrong, whether it was necessary or not, or things like that ...
I'm still a little child, hasn't growing up but getting younger ...

my-plurk

Banners

 blogger solo solo gitu what ...!!!


SLC


Bengawan, Komunitas Blogger Solo

Top Clicks

  • Tak ada

Blog Stats

  • 41,507 visitors

Supported by


WordPress
%d blogger menyukai ini: