Refresh, Back dan Reload dengan JavaScript
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: JavaScript
2 Comments:
kelebihannya apa ?
aku nggak donk sama javascript, mohon bantuannya :)
Ini dia yang saya cari!!!!!
terima kasih!!!!
Post a Comment
<< Home