Skip to content

Commit 25c8779

Browse files
committed
gallery
1 parent 39d9c17 commit 25c8779

File tree

9 files changed

+72
-0
lines changed

9 files changed

+72
-0
lines changed

gallery.html

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Image Gallery</title>
6+
<link rel="stylesheet" href="styles/layout.css" media="screen" />
7+
</head>
8+
<body>
9+
<h1>Snapshots</h1>
10+
<ul>
11+
<li>
12+
<a href="images/fireworks.jpg" title="A fireworks display" onclick = "showPic(this); return false;">Fireworks</a>
13+
</li>
14+
<li>
15+
<a href="images/coffee.jpg" title="A cup of black coffee" onclick = "showPic(this); return false;">A cup of black coffee</a>
16+
</li>
17+
<li>
18+
<a href="images/rose.jpg" title="A red, red rose" onclick="showPic(this); return false;">Rose</a>
19+
</li>
20+
<li>
21+
<a href="images/bigben.jpg" title="The famous clock" onclick="showPic(this); return false;">Big Ben</a>
22+
</li>
23+
</ul>
24+
<img id="placeholder" src="images/placeholder.gif" alt="my image gallery" />
25+
<p id="description">Choose an image.</p>
26+
<script type="text/javascript" src="scripts/showPic.js"></script>
27+
</body>
28+
</html>

images/bigben.jpg

25.6 KB
Loading

images/coffee.jpg

15.9 KB
Loading

images/fireworks.jpg

29.9 KB
Loading

images/placeholder.gif

5.59 KB
Loading

images/rose.jpg

38.3 KB
Loading

scripts/.DS_Store

6 KB
Binary file not shown.

scripts/showPic.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
function showPic(whichPic){
2+
var source = whichPic.getAttribute("href");
3+
var placeholder = document.getElementById("placeholder");
4+
placeholder.setAttribute("src", source);
5+
var text = whichPic.getAttribute("title");
6+
var description = document.getElementById("description");
7+
description.firstChild.nodeValue = text;
8+
}
9+
10+
function countBodyChildren(){
11+
var body_element = document.getElementsByTagName("body")[0];
12+
//alert(body_element.childNodes.length);
13+
alert(body_element.nodeType);
14+
}
15+
16+
//window.onload = countBodyChildren;

styles/layout.css

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
body{
2+
font-family: "helvetica", "Arial", serif;
3+
color: #333;
4+
background-color: #ccc;
5+
margin: 1em 10%;
6+
}
7+
h1{
8+
color:#333;
9+
background-color: transparent;
10+
}
11+
a{
12+
color:#c60;
13+
background-color: transparent;
14+
font-weight: bold;
15+
text-decoration: none;
16+
}
17+
ul{
18+
padding: 0;
19+
}
20+
li{
21+
float: left;
22+
padding: 1em;
23+
list-style: none;
24+
}
25+
img{
26+
display: block;
27+
clear: both;
28+
}

0 commit comments

Comments
 (0)