-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhome2.html
More file actions
29 lines (25 loc) · 795 Bytes
/
Copy pathhome2.html
File metadata and controls
29 lines (25 loc) · 795 Bytes
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
<html>
<head>
<meta charset="UTF-8">
<title> Execution Context of Javascript Functions</title>
</head>
<script type="text/javascript">
function check1(currentTextBox) {
if (currentTextBox.value === null || currentTextBox.value === '')
currentTextBox.style.background = '#fffacd';
else
currentTextBox.style.background = '#ffffff';
}
function check2() {
var obj = document.getElementsByTagName('input');
for (var i = 0; i < (obj.length - 1); i++) {
obj[i].style.background = '#fffacd';
}
}
</script>
<body>
<input type="text" id="text1" onfocus="check1(this)" onblur="check1(this)">
<input type="text" id="text2" onfocus="check1(this)" onblur="check1(this)">
<input type="button" value="next" onclick="check2()">
</body>
</html>