-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo_20170726.html
150 lines (144 loc) · 3.04 KB
/
demo_20170726.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>事件、函数、变量、判断</title>
<style type="text/css">
*{
margin: 0;
padding: 0;
border: none;
background: none;
vertical-align: middle;
outline: none;
}
a{
text-decoration: none;
}
html{
background: #ffffff;
}
body{
width: 1200px;
margin: auto;
}
.divo{
width: 1200px;
margin-top: 10px;
background: #ffffff;
border: 1px solid #cccccc;
padding: 24px;
box-shadow: 5px 3px 10px #cccccc;
}
.titleone{
cursor: pointer;
outline: none;
color: #7698A7;
font-size: 30px;
text-indent: 24px;
font-weight: 700;
line-height: 150px;
}
ul li{
list-style: none;
font-size: 16px;
line-height: 30px;
color: #4F6F7D;
}
#buttontwo{
display: none;
}
.three{
transition: all 2s;
}
.btn{
width: 100px;
height: 30px;
background: #fbdb65;
cursor: pointer;
border-radius: 5px;
transition: all 2s;
}
.btn:hover{
background: red;
color: #ffffff;
}
.active{
background: red;
}
</style>
</head>
<body>
<div class="divo titleone">
javascript
</div>
<div class="divo">
<ul>
<li>1.事件、函数</li>
<li><input type="button" name="" value="点击按钮" onclick="fun()" style=""class='btn'></li>
</ul>
</div>
<div class="divo">
<ul>
<li>2.移入移出(显示隐藏)</li>
<li id="eveno">
<label style="cursor:pointer;">
<input name="Fruit" type="checkbox" value="" / >显示啦
</label>
</li>
<li id="buttontwo">
<input type="button" name="" value="点击按钮" class='btn'>
</li>
</ul>
</div>
<div class="divo three">
3.函数 鼠标经过这个div执行变窄变高变色 移出再恢复
</div>
<div class="divo three">
<ul>
<li>4.网页换肤</li>
<li><input type="button" name="" value="样式1" class='btn' onclick="styleo()"> <input type="button" name="" value="样式2" class='btn' onclick="stylet()"></li>
</ul>
</div>
</body>
<script type="text/javascript">
var eveno = document.getElementById('eveno')
var buttontwo = document.getElementById('buttontwo')
var three = document.getElementsByClassName('three')[0]
var htmlo = document.getElementsByTagName('html')[0]
var btn = document.getElementsByClassName('btn')
function fun(){
alert('弹出窗口')
}
//弹框
eveno.onmouseover = function(){
buttontwo.style.display = 'block'
}
eveno.onmouseout = function(){
buttontwo.style.display = 'none'
}
//显示隐藏事件
three.onmouseover = function(){
this.style.height = '300px';
this.style.background = 'red';
this.style.color = '#ffffff';
}
three.onmouseout = function(){
this.style.height = '';
this.style.background = '';
this.style.color = '';
}
//鼠标悬浮的效果
function styleo(){
htmlo.style.background = '#cc0000'
btn[2].style.cssText="background:red;color:#ffffff"
btn[3].style.cssText="background:'';color:''"
alert(btn[2].style.cssText)
}
function stylet(){
htmlo.style.background = 'yellow'
btn[3].style.cssText="background:red;color:#ffffff"
btn[2].style.cssText="background:'';color:''"
}
</script>
</html>