-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zhangyue0503
committed
Jun 26, 2018
1 parent
a163928
commit 9e12fbc
Showing
31 changed files
with
465 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<script> | ||
setTimeout.call(window,()=>{ | ||
alert.call(window,1); | ||
},1000); | ||
// alert.call(window,1); | ||
// function show(){ | ||
// console.log(this+10); | ||
// } | ||
// show.call(1); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<script> | ||
function show(x,y,z){ | ||
// alert(this+x); | ||
console.log(x,y,z); | ||
} | ||
show.bind(1,2)(1); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<script> | ||
class a { | ||
constructor(x,y,z){ | ||
console.log(x,y,z); | ||
// this.x = 10; | ||
// console.log(this.x); | ||
} | ||
ffff(){ | ||
alert(1); | ||
} | ||
} | ||
|
||
new a(11,[1,2,3],{a:50}).ffff(); | ||
|
||
|
||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<script> | ||
var json = {a:20,b:30}; | ||
console.log(String.prototype.substring.call(json,2)); | ||
|
||
var a = ['asdasd']; | ||
|
||
console.log(String.prototype.split.call(a)); | ||
// console.log(Object.prototype.toString.call({})); | ||
function show(){ | ||
console.log(Object.prototype.toString.call(arguments)); | ||
} | ||
show(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<script> | ||
function show(){ | ||
// console.log(1); | ||
} | ||
show.prototype.a = function(){ | ||
alert(1); | ||
} | ||
var c = new show(); | ||
c.a(); | ||
// var c = show; | ||
// console.log(c.prototype); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>Document</title> | ||
<style> | ||
input.active { | ||
background: red; | ||
} | ||
|
||
#box>div { | ||
width: 200px; | ||
height: 200px; | ||
background: #ccc; | ||
display: none; | ||
} | ||
|
||
#box>div:first-of-type { | ||
display: block; | ||
} | ||
</style> | ||
</head> | ||
|
||
|
||
<body> | ||
<div id='div1'></div> | ||
<div class='div1'></div> | ||
<div class='div1'></div> | ||
<script> | ||
class jquery { | ||
constructor(obj) { | ||
this.obj = obj; | ||
this.allNode = []; | ||
switch (this.obj.charAt(0)) { | ||
case '#': | ||
this.allNode.push(document.getElementById(this.obj.substring(1))); | ||
console.log(this.allNode); | ||
break; | ||
case '.': | ||
this.myObj = document.getElementsByClassName(this.obj.substring(1)); | ||
for(let i=0;i<this.myObj.length;i++){ | ||
this.allNode.push(this.myObj[i]); | ||
} | ||
console.log(this.allNode); | ||
break; | ||
} | ||
} | ||
|
||
addClass(className){ | ||
for(let i=0;i<this.allNode.length;i++){ | ||
this.allNode[i].classList.add(className); | ||
} | ||
} | ||
} | ||
|
||
function $(obj) { | ||
return new jquery(obj); | ||
} | ||
$('#div1'); | ||
$('.div1').addClass('a'); | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>Document</title> | ||
<style> | ||
input.active { | ||
background: red; | ||
} | ||
|
||
#box>div { | ||
width: 200px; | ||
height: 200px; | ||
background: #ccc; | ||
display: none; | ||
} | ||
|
||
#box>div:first-of-type { | ||
display: block; | ||
} | ||
</style> | ||
</head> | ||
|
||
|
||
<body> | ||
<div id="box"> | ||
<input type="button" class="active" value="1"> | ||
<input type="button" value="2"> | ||
<input type="button" value="3"> | ||
<div>aaa</div> | ||
<div>bbb</div> | ||
<div>ccc</div> | ||
</div> | ||
<div id="ccc"> | ||
<input type="button" class="active" value="1"> | ||
<input type="button" value="2"> | ||
<div>bbb</div> | ||
<div>ccc</div> | ||
</div> | ||
<script> | ||
class tab { | ||
constructor(x) { | ||
this.node = document.getElementById(x); | ||
this.allIpt = this.node.getElementsByTagName('input'); | ||
this.allDiv = this.node.getElementsByTagName('div'); | ||
this.init(); | ||
this.index = 0; | ||
} | ||
init() { | ||
for (let i = 0; i < this.allIpt.length; i++) { | ||
this.allIpt[i].onclick = function () { | ||
this.hide(); | ||
this.show(i); | ||
}.bind(this); | ||
} | ||
} | ||
hide() { | ||
for (let i = 0; i < this.allIpt.length; i++) { | ||
this.allIpt[i].className = ''; | ||
this.allDiv[i].style.display = 'none'; | ||
} | ||
} | ||
show(index) { | ||
this.allDiv[index].style.display = 'block'; | ||
this.allIpt[index].className = 'active'; | ||
} | ||
|
||
} | ||
|
||
// new tab('box'); | ||
|
||
class autoTab extends tab{ | ||
constructor(x){ | ||
super(x); | ||
} | ||
autoPlay(){ | ||
// var _this = this; | ||
setInterval(()=>{ | ||
console.log(this); | ||
this.index++; | ||
if(this.index == this.allIpt.length)this.index = 0; | ||
this.hide(); | ||
this.show(this.index); | ||
},1000); | ||
} | ||
} | ||
new tab('box'); | ||
new autoTab('ccc').autoPlay(); | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>Document</title> | ||
<style> | ||
.active{ | ||
background:red; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<input type="button" value="1"> | ||
<input type="button" value="2"> | ||
<input type="button" value="3"> | ||
<script> | ||
let allInput = document.getElementsByTagName('input'); | ||
|
||
for(let i =0;i<allInput.length;i++){ | ||
//块级作用域 | ||
allInput[i].onclick = function(){ | ||
for(var j = 0;j<allInput.length;j++){ | ||
allInput[j].className = ''; | ||
} | ||
allInput[i].className = 'active'; | ||
alert(i); | ||
} | ||
|
||
// (function(x){ | ||
// // console.log(x); | ||
// allInput[x].onclick = function(){ | ||
// alert(x); | ||
// } | ||
// })(i); | ||
|
||
// allInput[i].onclick = function(){ | ||
// alert(i); | ||
// } | ||
} | ||
|
||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<script> | ||
// var a = 10; | ||
// var b = 20; | ||
// var c = 30; | ||
|
||
let [a,[b,c],d] = [10,[20,40],30]; | ||
console.log(a,b,c,d); | ||
|
||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<script> | ||
var json = {'a':20,'b':30}; | ||
|
||
let {a,b} = json; | ||
let {c,d} = json; | ||
console.log(a,b,c,d); | ||
|
||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.