Skip to content

Commit 0816dc9

Browse files
committed
11.29
1 parent 030c045 commit 0816dc9

42 files changed

Lines changed: 1267 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎基础/1.隐藏.html‎

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Document</title>
6+
<style type="text/css">
7+
li{
8+
list-style: none;
9+
}
10+
.lis{
11+
width: 80px;
12+
height: 30px;
13+
border: 1px solid #000;
14+
position: relative;
15+
}
16+
.lis a{
17+
text-decoration: none;
18+
display: block;
19+
line-height: 30px;
20+
text-align: center;
21+
color: #000;
22+
background: #ccc;
23+
}
24+
.lis ul{
25+
padding: 0;
26+
margin: 0;
27+
width: 80px;
28+
border: 1px solid #000;
29+
position: absolute;
30+
top: 30px;
31+
left: -1px;
32+
background: #ff9;
33+
display: none;
34+
}
35+
ul li{
36+
text-align: center;
37+
line-height: 30px;
38+
}
39+
</style>
40+
<!--
41+
把某个元素移出视线:
42+
1.display:none; 显示为无
43+
2.visibility:hidden; 隐藏
44+
3.改变width/height;
45+
4.透明度为0
46+
-->
47+
<script>
48+
window.onload=function(){
49+
var a=document.getElementById('lis');
50+
var b=document.getElementById('ul1');
51+
var c=document.getElementById('link');
52+
53+
a.onmouseover=function(){
54+
b.style.display='block';
55+
c.style.background = '#ff00ff'
56+
}
57+
a.onmouseout=function(){
58+
b.style.display='none';
59+
c.style.background = '#ccc'
60+
}
61+
}
62+
63+
</script>
64+
</head>
65+
<body>
66+
<ul >
67+
<li id="lis" class="lis">
68+
<a href="#" title="" id="link">微博</a>
69+
<ul id="ul1">
70+
<li>私信</li>
71+
<li>评论</li>
72+
<li>@我</li>
73+
</ul>
74+
</li>
75+
</ul>
76+
77+
78+
</body>
79+
</html>

‎基础/10.口令.html‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Document</title>
6+
<script type="text/javascript">
7+
window.onload=function(){
8+
var oText=document.getElementById('Text1');
9+
var oBtn=document.getElementById('btn');
10+
11+
oBtn.onclick=function(){
12+
if (oText.value=='') {
13+
alert('哥们,写点东西吧!')
14+
}else if (oText.value=='CSS') {
15+
alert('哥们,你写的是CSS,恭喜通过!')
16+
}else if (oText.value=='css') {
17+
alert('哥们,你写的是css,恭喜通过!')
18+
}else if (oText.value=='javascript') {
19+
alert('哥们,你写的是javscript,恭喜通过!')
20+
}else{
21+
alert('不好意思你输入的东西是:'+oText.value+'不允许通过!')
22+
}
23+
}
24+
}
25+
</script>
26+
</head>
27+
<body>
28+
输入口令:<input type="text" name="" id="Text1">
29+
<input type="button" name="" id="btn" value="确认">
30+
</body>
31+
</html>

‎基础/11.数组.html‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Document</title>
6+
</head>
7+
<body>
8+
<script type="text/javascript">
9+
var arr=['这是第一句话','这是第二句话','这是第三句话'];
10+
// alert(arr.length);
11+
arr.push('这是第四句话');
12+
alert(arr[3]);
13+
alert(arr[arr.length-1])
14+
</script>
15+
</body>
16+
</html>

‎基础/12.图片切换.html‎

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Document</title>
6+
<style type="text/css">
7+
#content{
8+
width: 400px;
9+
height: 400px;
10+
border: 1px solid #ccc;
11+
margin: 40px auto 0;
12+
position: relative;
13+
}
14+
#content a{
15+
width: 40px;
16+
height: 40px;
17+
background: #000000;
18+
border: 5px solid #ffffff;
19+
position: absolute;
20+
top: 175px;
21+
text-align: center;
22+
text-decoration: none;
23+
line-height: 40px;
24+
color: #ffffff;
25+
font-size: 30px;
26+
font-weight: bold;
27+
opacity: 0.8;
28+
}
29+
#content a:hover{
30+
opacity: 1;
31+
}
32+
#pre{
33+
left: 10px;
34+
}
35+
#next{
36+
right: 10px;
37+
}
38+
#text{
39+
position: absolute;
40+
bottom: 0;
41+
left: 0;
42+
width: 400px;
43+
height: 30px;
44+
line-height: 30px;
45+
text-align: center;
46+
color: #fff;
47+
background: #000;
48+
margin: 0;
49+
}
50+
#span1{
51+
position: absolute;
52+
top: 0;
53+
left: 0;
54+
width: 400px;
55+
height: 30px;
56+
line-height: 30px;
57+
text-align: center;
58+
color: #fff;
59+
background: #000;
60+
margin: 0;
61+
}
62+
#img1{
63+
width: 400px;
64+
height: 400px;
65+
}
66+
67+
</style>
68+
<script>
69+
window.onload=function(){
70+
var oPre=document.getElementById('pre');
71+
var oNext=document.getElementById('next');
72+
var oText=document.getElementById('text');
73+
var oSpan=document.getElementById('span1');
74+
var oImg=document.getElementById('img1');
75+
76+
var arrUrl=['images/1.png','images/2.jpg','images/3.jpg','images/5.jpg'];
77+
var arrText=['游戏','性感','前端','学校'];
78+
79+
//初始化
80+
var num=0;
81+
function fnTab(){
82+
oSpan.innerHTML=num+1+'/'+arrUrl.length;
83+
oImg.src=arrUrl[num];
84+
oText.innerHTML=arrText[num];
85+
}
86+
fnTab();
87+
88+
oPre.onclick=function(){
89+
num--;
90+
if (num==-1) {
91+
num=arrUrl.length-1;
92+
};
93+
fnTab();
94+
}
95+
96+
oNext.onclick=function(){
97+
num++;
98+
if (num==arrUrl.length) {
99+
num=0;
100+
};
101+
fnTab();
102+
}
103+
}
104+
105+
//初始化
106+
107+
</script>
108+
</head>
109+
<body>
110+
<div id="content">
111+
<a href="#" title="" id="pre">&lt;</a>
112+
<a href="#" title="" id="next">&gt;</a>
113+
<span id="span1">数量正在计算中...</span>
114+
<p id="text">图片正在加载中...</p>
115+
<img id="img1" src="" alt="">
116+
</div>
117+
</body>
118+
</html>

‎基础/13.for循环.html‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Document</title>
6+
<script>
7+
window.onload=function(){
8+
var oUL=document.getElementById('list');
9+
var aLi=oUL.getElementsByTagName('li');
10+
var arr=['今天','明天','后天','昨天'];
11+
12+
for (var i = 0; i < aLi.length; i++) {
13+
14+
aLi[i].innerHTML=arr[i];
15+
16+
aLi[i].onclick=function(){
17+
alert(i);
18+
}
19+
}
20+
}
21+
</script>
22+
</head>
23+
<body>
24+
<ul id="list">
25+
<li></li>
26+
<li></li>
27+
<li></li>
28+
<li></li>
29+
</ul>
30+
</body>
31+
</html>

‎基础/14.for循环2.html‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Document</title>
6+
</head>
7+
<body>
8+
<script>
9+
window.onload=function(){
10+
var str='';
11+
for (var i = 0; i < 2000; i++) {
12+
str+='<input type="button" value="按钮">';
13+
}
14+
document.body.innerHTML=str;
15+
}
16+
</script>
17+
</body>
18+
</html>

‎基础/15.计算坐标位置.html‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Document</title>
6+
<style>
7+
div{
8+
width: 50px;
9+
height: 50px;
10+
background: #ff0000;
11+
position: absolute;
12+
top: 0;
13+
left: 0;
14+
font-size: 30px;
15+
line-height: 50px;
16+
text-align: center;
17+
color: #ffffff;
18+
}
19+
</style>
20+
<script>
21+
window.onload=function(){
22+
var aDiv=document.getElementsByTagName('div');
23+
24+
for (var i = 0; i < 10; i++) {
25+
document.body.innerHTML+='<div>'+i+'</div>';
26+
}
27+
28+
29+
for (var i = 0; i < aDiv.length; i++) {
30+
aDiv[i].style.left = 10+i*60+'px';
31+
aDiv[i].style.top = 10+i*60+'px';
32+
}
33+
}
34+
</script>
35+
</head>
36+
<body>
37+
38+
</body>
39+
</html>

‎基础/16.for循环.html‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Document</title>
6+
<script>
7+
var arr=[[1,2,3],[4,5,6],[7,8,9]];
8+
for (var i = 0; i < arr.length; i++) {
9+
for (var j = 0; j < arr[i].length; j++) {
10+
alert(arr[i][j]);
11+
}
12+
}
13+
</script>
14+
</head>
15+
<body>
16+
17+
</body>
18+
</html>

0 commit comments

Comments
 (0)