-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
46 lines (40 loc) · 1.24 KB
/
Copy pathscript.js
File metadata and controls
46 lines (40 loc) · 1.24 KB
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
var name = prompt("What's your name?");
document.getElementById("welcome").innerHTML = "Welcome " + name;
function sayHello(){
alert("Hello");
}
var counter = 0;
function count(){
counter = counter + 1;
document.getElementById("number").innerHTML = counter;
if (document.getElementById("number").innerHTML > 5) {
document.getElementById("counting").innerHTML = "You have more than 5 clicks.";
}
else if (document.getElementById("number").innerHTML == 5){
document.getElementById("counting").innerHTML = "You have 5 clicks.";
}
else {
document.getElementById("counting").innerHTML = "You have less than 5 clicks.";
}
}
function input(textbox) {
if(event.keyCode == 13) {
var output = document.getElementById('output');
output.innerHTML += "<br>" + textbox.value;
}
}
function changeImage() {
var image = document.getElementById("beaver");
var imageURL1 = "http://web.mit.edu/graphicidentity/images/examples/tim-the-beaver-1.png";
var imageURL2 = "https://slice.mit.edu/wp-content/uploads/2013/11/Beaver_Slice_22.jpg";
var imageURL3 = "beaver.png";
if (image.src == imageURL1) {
image.src = imageURL2;
}
else if (image.src == imageURL2) {
image.src = imageURL3;
}
else {
image.src = imageURL1;
}
}