Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files via upload #5

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Others/JS_day01/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<!-- JS代码需要编写在script标签中 -->
<script type="text/javascript">
alert("警告框")//控制浏览器弹出一个警告框
document.write("<b><i>可以向body中输出一个内容</i></b>");//让计算机在页面中输出一个内容
console.log("在控制台出现")//向控制台输出一个内容
</script>
<script type="text/javascript" src="js/script.js" >
alert("这个js标签的内部代码不会被执行");
</script>
</head>
<body>
<button onclick="alert('点了按钮')">按钮</button>
<a href="javascript:alert('点了链接')">超链接</a>
<button onclick="return confirm('确定?')">确认按钮</button>
用户名: <input onblur="alert('失去焦点.')" />
</body>
</html>
1 change: 1 addition & 0 deletions Others/JS_day01/js/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert("外部js代码")
36 changes: 36 additions & 0 deletions Others/JS_day02/代码块.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script>
{
var a = 123;//外部可调用
alert("警告框")//控制浏览器弹出一个警告框
document.write("<b><i>可以向body中输出一个内容</i></b>");//让计算机在页面中输出一个内容
console.log("在控制台出现")//向控制台输出一个内容
}
var year = prompt("input a year:")//可以弹出一个提示框,该提示框会带有一个文本框,并带有括号中的提示。
if(!isNaN(year)&&year!=null){
if(year%400==0||(year%100!=0&&year%4==0)){
console.log(year+"是闰年");
}else{
console.log(year+"不是闰年")
}
}else{
console.log("不是年份");
}
var score = 80;
switch(parseInt(prompt("input a score:")/10)){
case 10: console.log("level 10"); break;
case 9: console.log("level 9"); break;
case 8: console.log("level 8"); break;
case 7: console.log("level 7"); break;
case 6: console.log("level 6"); break;
default: console.log("level fail"); break;
}
</script>
</head>
<body>
</body>
</html>
15 changes: 15 additions & 0 deletions Others/JS_day02/数据类型.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script>
var a=1+ +"2"+ 3;
console.log(a);
console.log(typeof(a));
</script>
</head>
<body>

</body>
</html>
18 changes: 18 additions & 0 deletions Others/JS_day03/Array.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script>
var arr=['a','b','c','d','e'];
for(var i=0;i<arr.length;i++){
console.log(arr[i]);
}
for( var i in arr){//遍历对象的时候可能不对。
console.log(arr[i]);
}
</script>
</head>
<body>
</body>
</html>
57 changes: 57 additions & 0 deletions Others/JS_day03/String.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<!--<script>
var str = " abc ";
console.log(" abc ".length);//5,识别空格
</script>
<script type="text/javascript">
var arr = new Array(3)
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"
document.write(arr + "<br />");//George,John,Thomas
document.write(arr.push("James") + "<br />");//4
document.write(arr+"<br\>");//George,John,Thomas,James
document.write(arr.pop());
</script>-->
<script>
/*var arr = new Array(6);
arr[0] = "10";
arr[1] = "5";
arr[2] = "40";
arr[3] = "25";
arr[4] = "1000";
arr[5] = "1";
var date=new Date();
document.write(date+"<br />");
document.write(date.getFullYear()+"<br />");
document.write(date.toLocaleString());
var a =5.5;
document.write(Math.floor(a));
document.write(a);
eval("alert('qqq')");
document.write(eval("5+5"));*/
function add(){
var sum=0;
for(var i=0;i<arguments.length;i++){
sum+=arguments[i];
}
return sum;
}
document.write(add(1,2));
document.write(add(1,2,3));
document.write(add(1,2,3,4,5,6,7,8,9));
document.write(navigator.appName + "</p>")
document.write(screen.height + "</p>");
document.write(screen.width + "</p>");
document.write(location.href);

</script>
<body>
<button onclick="location.href='https://www.baidu.com'">百度</button>
<button onclick="location.href='index.html'">百度</button>
</body>
</html>
10 changes: 10 additions & 0 deletions Others/JS_day03/a.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<a href="b.html">AAAAA</a>
</body>
</html>
12 changes: 12 additions & 0 deletions Others/JS_day03/b.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<input type="button" onclick="history.back()" value="back" />
<input type="button" onclick="history.forward()" value="next" />
<a href="c.html">BBBBB</a>
</body>
</html>
16 changes: 16 additions & 0 deletions Others/JS_day03/c.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script>
var arr = new Array("George","John","Thomas");
document.write(arr);
document.write(arr.reverse());//Thomas,John,George
document.write(arr);
</script>
</head>
<body>
<a href="a.html">CCCCC</a>
</body>
</html>
35 changes: 35 additions & 0 deletions Others/JS_day03/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style>
span{
width: 80px;
display: inline-block;
}
</style>
<script>
for(var i=1;i<=9;i++){
for(var j=1;j<=i;j++){
document.write("<span>"+j+"*"+i+"="+j*i+"</span>");
}
document.write("<br />");
}
</script>
<script>
a:for(var i=2; i<100; i++){
for(var j=2; j<i/2+1; j++){
if(i%j==0){
continue a;
}
}
document.write(i);
document.write("<br />");
}
</script>
</head>
<body>

</body>
</html>
56 changes: 56 additions & 0 deletions Others/JS_day03/函数.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script>
function fun(){//1.无参方法
alert("fun方法");
}
fun();//可以直接在js里调用。
function add(a,b){//2.有参方法
var c = a+b;
alert(a+"+"+b+"="+c);
}
add(1,2);
function addReturn(a,b){//3.有参有返回值方法
var c = a+b;
return c;
}
alert(addReturn(1,2));
</script>
<script>
var a = function(a,b){
alert(a+b);
}
a(1,2);//函数也是对象,所以直接给函数对象传参。
console.log(a);//function (a,b){alert(a+b);}"
console.log(typeof(a));//function
</script>
<script>
var cs="x,y";
var fft="var sum=x+y; return sum;";
var add = new Function(cs,fft);//也可以直接把参数写进去
alert(add(1,2));
</script>
<script>
var str="全局变量";
alert("方法外部: "+str);
function fun(){
alert("方法内部: "+str);
}
fun();
</script>
<script>
alert("另一个sctipt: "+str);
</script>
<script>
function fun(){
var str
}
</script>
</head>
<body>

</body>
</html>
29 changes: 29 additions & 0 deletions Others/JS_day04/Document对象.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>

</head>
<body>
<input id="name" name="username" value="这是id为name的value(改之前)。"/>
<br />
<input id="input1" type="checkbox" value="吃饭" name="hobby"/><label for="input1">吃饭</label>
<input id="input2" type="checkbox" value="篮球" name="hobby"/><label for="input2">篮球</label>
<input id="input3" type="checkbox" value="足球" name="hobby"/><label for="input3">足球</label>
<br />

<script>
var username = document.getElementById("name");//通过id得到元素。
console.log(username.value);//得到input里面的value的值。username.id/username.name/username.value
username.value="这是id为name的value(改之后)。";
var inputs1 = document.getElementsByName("hobby");//使用getElementsByName得到input标签
for(var i=0;i<inputs1.length;i++){//遍历inputs数组,得到标签里面具体的值。
var hobby=inputs1[i];
console.log(hobby.value);
}
var inputs2 = document.getElementsByTagName("input");
console.log(inputs2.length);
</script>
</body>
</html>
10 changes: 10 additions & 0 deletions Others/JS_day04/js的DOM对象.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<span id="sId">span标签</span>
</body>
</html>
44 changes: 44 additions & 0 deletions Others/JS_day04/user.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head><!--页面2-->
<meta charset="UTF-8">
<title></title>
<script>
function fun(num,name){
var win = window.opener;//需要跨页面操作,opener 返回对创建此窗口的窗口的引用。
win.document.getElementById("uId").value = num;//需要把num和name赋值到window窗口。
win.document.getElementById("name").value = name;
window.close();
}
</script>
</head>
<body>
<table border="1">
<tr>
<th>操作</th>
<th>编号</th>
<th>姓名</th>
</tr>
<tr>
<td><input type="button" value="选择" onclick="fun('number1','name1')"/></td>
<td>number1</td>
<td>name1</td>
</tr>
<tr>
<td><input type="button" value="选择" onclick="fun('number2','name2')"/></td>
<td>number2</td>
<td>name2</td>
</tr>
<tr>
<td><input type="button" value="选择" onclick="fun('number3','name3')"/></td>
<td>number3</td>
<td>name3</td>
</tr>
<tr>
<td><input type="button" value="选择" onclick="fun('number4','name4')"/></td>
<td>number4</td>
<td>name4</td>
</tr>
</table>
</body>
</html>
Loading