Created
April 3, 2012 14:59
-
-
Save h4/2292707 to your computer and use it in GitHub Desktop.
Итог задания 05.2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>window.location</title> | |
<meta charset="utf-8"> | |
<meta http-equiv="x-ua-compatible" content="ie=edge"> | |
<style type="text/css"> | |
#view { | |
background:#FFC; | |
padding: 10px; | |
margin: 20px 0px 40px 0px; | |
} | |
</style> | |
<script type="text/javascript"> | |
window.onload = parseUrl; | |
function parseUrl() { | |
var search = location.search.substring(1), | |
data, | |
show, | |
target, | |
targetObj, | |
text; | |
if (search.length > 1) { | |
data = search.split('&'); | |
show = data[0].split('=')[1]; | |
target = data[1].split('=')[1]; | |
targetObj = document.getElementById(target); | |
text = document.getElementById(show).innerHTML; | |
targetObj.innerHTML = text; | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<ul id="links"> | |
<li><a href="?show=part1&target=view">Занятие 1</a></li> | |
<li><a href="?show=part2&target=view">Занятие 2</a></li> | |
<li><a href="?show=part3&target=view">Занятие 3</a></li> | |
</ul> | |
<div id="view"></div> | |
<div class="content"> | |
<div id="part1">Занятие 1. Введение в JavaScritpt</div> | |
<div id="part2">Занятие 2. Создание циклов. Функции</div> | |
<div id="part3">Занятие 3. Поддержка событий. Базовые объекты</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment