-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform.html
More file actions
53 lines (44 loc) · 1.35 KB
/
form.html
File metadata and controls
53 lines (44 loc) · 1.35 KB
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
<!DOCTYPE html>
<html lang="zh">
<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>
<script>
// var box = document.querySelector('.box');
// console.log(box);//null
window.onload = function (){//页面加载完成时触发(html, css, js , 图片,音视频等资源加载完成才执行)
var box = document.querySelector('.box');
console.log(box);
}
</script>
</head>
<body>
<!-- key=value -->
<!-- https://www.baidu.com/?username=xiaocuo&password=123456&sex=1 -->
<form action="https://www.baidu.com/" method="get">
账号:<input type="text" name="username"><br/>
密码:<input type="text" name="password"><br/>
性别:<select name="sex">
<option value="0">女</option>
<option value="1">男</option>
<option value="2">未知</option>
</select><br/>
<input type="submit" value="注册">
</form>
<div class="box">一个坑</div>
<img class="pic" src="http://pic39.photophoto.cn/20160411/1155116845138548_b.jpg" alt="">
<script>
// dom节点渲染完成
var form = document.querySelector('form');
form.onsubmit = function (){
alert('注册成功');
}
var pic = document.querySelector('.pic');
pic.onload = function (){
alert('图片加载完成');
}
</script>
</body>
</html>