-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
121 lines (120 loc) · 3.91 KB
/
index.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>solar system</title>
</head>
<style type="text/css">
body{
font-family: "Arial";
color:#333;
background-color: #ccc;
margin: 16px 10%;
}
h1{
color:#333;
background-color: transparent;
}
a{
color: #c60;
background-color: transparent;
font-weight: bold;
text-decoration: none;
}
ul{
padding:0;
}
li{
float: left;
padding:1em;
list-style: none;
}
img{
display: block;
clear: both;
}
#imagegallery{
list-style: none;
}
#imagegallery li{
display: inine;
}
#imagegallery li a img{
border: 10px;
width: 40px;
height: 30px;
}
/* 固定占位符大小 */
#placeholder{
width: 400px;
height: 300px;
}
</style>
<body>
<h1>Solar System</h1>
<ul id="imagegallery">
<li><a title="This is Sun" href="static/Sun太阳.jpg" ><img src="static/Sun太阳.jpg ">Sun</a></li><!-- the Sun -->
<li><a title="This is Mecurcy" href="static/Mecurcy水星.jpg" ><img src="static/Mecurcy水星.jpg ">Mecurcy</a></li><!-- the Mecurcy-->
<li><a title="This is Venus" href="static/Venus金星.jpg" ><img src="static/Venus金星.jpg ">Venus</a></li><!-- the Venus-->
<li><a title="This is Earth" href="static/Earth地球.jpg" ><img src="static/Earth地球.jpg ">Earth</a></li><!-- the Earth-->
<li><a title="This is Mars" href="static/Mars火星.jpg" ><img src="static/Mars火星.jpg ">Mars</a></li><!-- the Mars-->
<li><a title="This is Saturn" href="static/Saturn土星.jpg" ><img src="static/Saturn土星.jpg ">Saturn</a></li><!-- the Saturn-->
<li><a title="This is Uranus" href="static/Uranus天王.jpg" ><img src="static/Uranus天王.jpg ">Uranus</a></li><!-- the Uranus-->
<li><a title="This is Neptune" href="static/Neptune海王星.jpg" ><img src="static/Neptune海王星.jpg">Neptune</a></li><!-- the Neptune-->
<li><a title="This is Pluto" href="static/Pluto冥王星.jpg" ><img src="static/Pluto冥王星.jpg ">Pluto</a></li><!-- the Pluto-->
</ul>
<img id="placeholder" src="./static/0.jpg">
<p id="description">This is sun system.</p>
<!-- 平稳退化 -->
<a href="http://www.4399.com" onclick="popUp(this.href);return false;">平稳退化,防止禁用persudo-protocol</a><br>
<a href="http://www.4399.com">一般性做法</a>
<script>
/*完成*/
function showPic(whichpic){
var source = whichpic.getAttribute('href');
if(!document.getElementById('placeholder')) return true;
var placeholder = document.getElementById('placeholder');
if(placeholder.nodeName != 'IMG') return false;
placeholder.setAttribute('src',source);
if(document.getElementById("description")){
var text = whichpic.getAttribute('title') ? whichpic.getAttribute('title') : "";
var description = document.getElementById('description');
if(description.firstChild.nodeType == 3){
description.firstChild.nodeValue = text;
}
}
return true;
}
/*完成*/
function prepareGallery(){
if(!document.getElementsByTagName) return false;
if(!document.getElementById) return false;
if(!document.getElementById('imagegallery')) return false;
var gallery = document.getElementById('imagegallery');
var links = gallery.getElementsByTagName("a");
for(var i = 0; i<links.length; i++){
links[i].onclick = function(){
return showPic(this) ? false : true;
}
}
}
/*弹窗*/
function popUp(winURL){
window.open(winURL,"popUp","width=1000,height=480");
}
/*添加到window.onload*/
function addLoadEvent(func){
var oldEvent = window.onload;
if(typeof(oldEvent) != 'function'){
window.onload = func();
}else{
window.onload = function(){
oldEvent();
func();
}
}
}
addLoadEvent(prepareGallery);
</script>
</body>
</html>