Tuesday, December 13, 2011

Refresh, Back dan Reload dengan JavaScript

Logo Refresh

Tombol Refresh

//Metode 1
window.location.reload();
//Metode 2
history.go(0);
//Metode 3
window.location.href = window.location.href;

Contoh

<input type="button" value="Refresh Halaman" onClick="window.location.reload()" />
<input type="button" value="Refresh Halaman" onclick="history.go(0);" />
<input type="button" value="Refresh Halaman" onclick="window.location.href=window.location.href;" />

Back dan Forward

history.go(-1); //back
history.go(1); //forward

Contoh

<a href="javascript:history.go(-1)">Kembali</a>
<a href="javascript:history.go(1)">Maju</a>

Labels:

2 Comments:

At Tuesday, December 13, 2011 at 6:31:00 PM GMT+7, Blogger Admin said...

kelebihannya apa ?
aku nggak donk sama javascript, mohon bantuannya :)

 
At Friday, January 18, 2013 at 6:28:00 PM GMT+7, Blogger budkalon said...

Ini dia yang saya cari!!!!!
terima kasih!!!!

 

Post a Comment

<< Home