-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjavascript.js
More file actions
56 lines (41 loc) · 1.81 KB
/
Copy pathjavascript.js
File metadata and controls
56 lines (41 loc) · 1.81 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
47
48
49
50
51
52
53
54
55
56
//Her er scriptet for kalkulator nettsiden
function add_one(){
//x = x + 1
document.getElementById("demo").innerHTML += 1;
}
function add_two(){
//x = x + 2
document.getElementById("demo").innerHTML += 2;
}
function pluss(){
document.getElementById("demo").innerHTML += "+";
}
let text = document.getElementById("demo")
let result = eval(text)
function calculate(){
document.getElementById("answer").innerHTML = result;
console.log(result);
}
//her er skriptet for quote nettsiden
let btn = document.getElementById("btn");
let output = document.getElementById("output");
let quotes =
[
"Spread love everywhere you go. Let no one ever come to you without leaving happier -Mother Teresa",
"When you reach the end of your rope, tie a knot in it and hang on. -Franklin D. Roosevelt",
"Always remember that you are absolutely unique. Just like everyone else. -Margret Mead",
"Don't judge each day by the harvest you reap but by the seeds that you plant. -Robert Louis Stevnson",
"The future belongs to those who believe in the beauty of their dreams. -Elanor Roosvelt",
"Tell me and I forget. Teach me and I remember. Involve me and I learn. -Benjamin Franklin",
"The best and most beautiful things in the world cannot be seen or even touched - they must be felt with the heart. -Helen Keller",
"It is during our darkest moments that we must focus to see the light. -Aristotle",
"Whoever is happy will make others happy too. -Anne Frank",
"Do not go where the path may lead, go instead where there is no path and leave a trail. -Ralph Waldo Emerson",
];
btn.addEventListener("click", function(){
console.log("Click on button")
var quoteIndex = Math.floor(Math.random() * quotes.length)
console.log(quoteIndex)
var randomQuote = quotes[quoteIndex]
output.innerHTML = randomQuote;
})