Skip to content

Commit 4cfcadc

Browse files
author
Chris Mills
committed
initial repo population
0 parents  commit 4cfcadc

File tree

5 files changed

+102
-0
lines changed

5 files changed

+102
-0
lines changed

images/firefox-icon.png

62.5 KB
Loading

images/firefox2.png

19.4 KB
Loading

index.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>My test page</title>
6+
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
7+
<link href="styles/style.css" rel="stylesheet" type="text/css">
8+
</head>
9+
<body>
10+
<h1>Mozilla is cool</h1>
11+
<img src="images/firefox-icon.png" alt="The Firefox logo: a flaming fox surrounding the Earth.">
12+
13+
<p>At Mozilla, we’re a global community of</p>
14+
15+
<ul> <!-- changed to list in the tutorial -->
16+
<li>technologists</li>
17+
<li>thinkers</li>
18+
<li>builders</li>
19+
</ul>
20+
21+
<p>working together to keep the Internet alive and accessible, so people worldwide can be informed contributors and creators of the Web. We believe this act of human collaboration across an open platform is essential to individual growth and our collective future.</p>
22+
23+
<p>Read the <a href="https://www.mozilla.org/en-US/about/manifesto/">Mozilla Manifesto</a> to learn even more about the values and principles that guide the pursuit of our mission.</p>
24+
<button>Change user</button>
25+
<script src="scripts/main.js"></script>
26+
</body>
27+
</html>

scripts/main.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Image switcher code
2+
3+
var myImage = document.querySelector('img');
4+
5+
myImage.onclick = function() {
6+
var mySrc = myImage.getAttribute('src');
7+
if(mySrc == 'images/firefox-icon.png') {
8+
myImage.setAttribute ('src','images/firefox2.png');
9+
} else {
10+
myImage.setAttribute ('src','images/firefox-icon.png');
11+
}
12+
}
13+
14+
// Personalized welcome message code
15+
16+
var myButton = document.querySelector('button');
17+
var myHeading = document.querySelector('h1');
18+
19+
function setUserName() {
20+
var myName = prompt('Please enter your name.');
21+
localStorage.setItem('name', myName);
22+
myHeading.innerHTML = 'Mozilla is cool, ' + myName;
23+
}
24+
25+
if(!localStorage.getItem('name')) {
26+
setUserName();
27+
} else {
28+
var storedName = localStorage.getItem('name');
29+
myHeading.innerHTML = 'Mozilla is cool, ' + storedName;
30+
}
31+
32+
myButton.onclick = function() {
33+
setUserName();
34+
}

styles/style.css

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
html {
2+
font-size: 10px;
3+
font-family: 'Open Sans', sans-serif;
4+
}
5+
6+
7+
h1 {
8+
font-size: 60px;
9+
text-align: center;
10+
}
11+
12+
p, li {
13+
font-size: 16px;
14+
line-height: 2;
15+
letter-spacing: 1px;
16+
}
17+
18+
19+
html {
20+
background-color: #00539F;
21+
}
22+
23+
body {
24+
width: 600px;
25+
margin: 0 auto;
26+
background-color: #FF9500;
27+
padding: 0 20px 20px 20px;
28+
border: 5px solid black;
29+
}
30+
31+
h1 {
32+
margin: 0;
33+
padding: 20px 0;
34+
color: #00539F;
35+
text-shadow: 3px 3px 1px black;
36+
}
37+
38+
img {
39+
display: block;
40+
margin: 0 auto;
41+
}

0 commit comments

Comments
 (0)