-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassignment2.html
88 lines (68 loc) · 2.49 KB
/
assignment2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<!doctype html>
<html lang="en-UK">
<head>
<link rel="stylesheet" href="cmsstyle.css" />
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> https://cs1.ucc.ie/~km34/assignment2.html </title>
</head>
<body onload="changeContent('home.txt')">
<script>
function changeContent(fileName){
// This is for the delay
var seconds = window.prompt("No of milliseconds?", seconds);
fileName="delay.php?loc="+fileName+"?ms="+seconds;
var contentBox=document.getElementById("content");
// Check if file is there first
loadProp=new XMLHttpRequest();
loadProp.onreadystatechange =
function (){
if (this.readyState < 4) {
displayMessage("Getting there...."); }
else {
if (this.status == 200) {
contentBox.innerHTML = this.responseText;
displayMessage("Content loaded"); }
else {
displayMessage(this.status + " " +this.statusText);
}
}
};
loadProp.open("GET", fileName, true);
loadProp.send();
}
function changeCSS(fileName){
var head = document.getElementsByTagName('head')[0];
head.getElementsByTagName('link')[0].href=fileName;
}
function displayMessage(message){
var messagetBox=document.getElementById("messages");
messagetBox.innerHTML=message
}
</script>
<header>
</header>
<nav>
<img src="uccLogo.png" />
<button type="button" class="a" id="1" onclick="changeContent('home.txt')"> Home </button>
<button type="button" class="a" id="2" onclick="changeContent('studies.txt')">Studies </button>
<button type="button" class="a" id="3" onclick="changeContent('about.txt')"> About Me </button>
<button type="button" class="a" id="4" onclick="changeContent('links.txt')">Links </button>
</nav>
<section id="content">
</section>
<form >
<button type="button" id="cmsstyle.css" class="changeCSS" onclick="changeCSS('cmsstyle.css')" >
Click to change stylesheet One
</button>
<button type="button" id="cmsstyle2.css" class="changeCSS" onclick="changeCSS('cmsstyle2.css')">
Click to change stylesheet Two
</button>
</form>
<section id="messages">
</section>
<footer>
</footer>
</body>
</html>