任务十三:零基础JavaScript编码(一)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE html>
<html>
<head>
<meta charset=“utf-8”>
<title>IFE JavaScript Task 01</title>
</head>
<body>
<label>请输入北京今天空气质量:
<input id=“aqi-input” type=“text”>
</label>
<button id=“button” onclick=“print()”>确认填写</button>
<div>您输入的值是:<span id=“aqi-display”>尚无录入</span></div>
<script type=“text/javascript”>
function print() {
var aqi_input = document.getElementById(“aqi-input”);
var aqi_display = document.getElementById(“aqi-display”);
aqi_display.innerHTML = aqi_input.value;
};
</script>
</body>
</html>