Skip to content

Instantly share code, notes, and snippets.

@h4
Created April 2, 2012 20:20
Show Gist options
  • Save h4/2286946 to your computer and use it in GitHub Desktop.
Save h4/2286946 to your computer and use it in GitHub Desktop.
Объект window.location
<html>
<head>
<title>Перезагрузка страницы</title>
<script type="text/javascript">
function reloadPage() {
window.location.reload();
}
</script>
</head>
<body>
<input type="button" value="Reload page" onclick="reloadPage()" />
</body>
</html>
<html>
<head>
<title>Переадресация c использованием javascript</title>
<script type="text/javascript">
function currLocation() {
alert(window.location);
}
function newLocation() {
window.location="http://www.avalon.ru/";
}
</script>
</head>
<body>
<input type="button" onclick="currLocation()" value="Показать URL страницы">
<input type="button" onclick="newLocation()" value="Перейти на другую страницу">
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment