PDA

View Full Version : go back automatically in javascript


lara_bcl
04-12-2007, 06:52 AM
<a href="javascript: history.go(-1)">Back</a>

this does - on click go back to previous page right..

can you tell me equivalen code to go back automatically.. i.e. with a possible time delay

thank you

BonRouge
04-13-2007, 02:49 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>going back in 5</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
* {
margin:0;
padding:0;
}
body {
background-color:white;
}
</style>
<script type="text/javascript">
function goBack() {
javascript: history.go(-1);
}
function timer() {
setTimeout("goBack()", 5000);
}
window.onload=timer;
</script>
</head>
<body>
<p>Going back pretty soon.</p>
</body>
</html>