This commit is contained in:
postautistic 2016-12-17 19:41:35 -05:00
parent 3c67bd293d
commit 7eecacb787
1 changed files with 13 additions and 5 deletions

View File

@ -9,18 +9,26 @@
<body>
<script src="assets/script.js"></script>
<script>
function switchTab() {
function setHash() {
window.location.hash = this.id;
}
onload = function () {
if (window.location.hash.substring(1)) {
document.getElementById(window.location.hash.substring(1)).checked = true;
function switchTab() {
hash = window.location.hash.substring(1);
if (hash) {
document.getElementById(hash).checked = true;
} else {
document.getElementById('study').checked = true;
}
}
onload = function () {
switchTab();
window.onhashchange = switchTab;
var tabs = document.getElementsByName('tabs');
for (var i = 0; i < tabs.length; i++) {
tabs[i].onclick = switchTab;
tabs[i].onclick = setHash;
}
}
</script>