Repository navigation
Expand file tree
/
Copy pathbasic_events.js
More file actions
100 lines (46 loc) · 1.93 KB
/
Copy pathbasic_events.js
File metadata and controls
100 lines (46 loc) · 1.93 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//<input type = "text" id="fname" onfocus = "focus_func()"></input> ---->in html
function focus_func() {
document.getElementById("fname").style.backgroundColor="#0f0";
//change color of textbox when focused
}
//jis py focus ho aus ka clr change hoo jai
//<input type = "text" id="fname" onfocus = "focus_func(this)"></input> ---->in html
function focus_func(element) {
element.style.backgroundColor="#0f0";
//change color of textbox when focused
}
//pehlay focus hoo then blur hoo jai
//<input type = "text" id="fname" onfocus = "focus_func(this)" onblur ="blur_func(this)" oninput = "input(this)"></input> ---->in html
function focus_func(element) {
element.style.backgroundColor="#0f0";
//change color of textbox when focused
}
function blur_func(element) {
element.style.backgroundColor="";
//change color of textbox when focused
}
function input(element) {
var x = element.value;
document.getElementById("test").innerHTML = x;
}
{/* <div id = "test" style = "border:1px">
</div> */}
//<input type = "text" id="fname" onfocus = "focus_func(this)" onblur ="blur_func(this)" onchange = "change(this)"></input> ---->in html
function input(element) {
var x = element.value;
document.getElementById("test").innerHTML = x;
}
//<input type = "text" id="fname" onfocus = "focus_func(this)" onblur ="blur_func(this)" onchange = "change(this)" onselect = "select()"></input> ---->in html
function select() {
console.log("You selected this ....");
}
<form action = "" onsubmit = "submit()">
</form>
function submit() {
alert("you submitted this form");
}
function submit() {
var x = document.getElementById("fname").value;
alert("you submitted" + x);
}
//<input type = "text" id="fname" onfocus = "focus_func(this)" onblur ="blur_func(this)" onchange = "change(this)" onselect = "select()" onvalid = "alert(Please fill out this field"></input> ---->in html