forked from Pooja9824/Javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form in js.html
48 lines (40 loc) · 1.52 KB
/
Form in js.html
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
<html>
<title>Form With javascript Masala</title>
<head>
<script type="text/javascript">
function display() {
var name = document.getElementById("txt1").value.toUpperCase();
var sirnmae = document.getElementById("txt2").value.toUpperCase();
var fullname = name + " " + sirnmae;
document.getElementById("txt3").value = fullname;
}
function alldata() {
var name = document.getElementById("txt1").value.toUpperCase();
var sirnmae = document.getElementById("txt2").value.toUpperCase();
var fullname = document.getElementById("txt3").value;
var addr = document.getElementById("address").value;
var mob = document.getElementById("mobile").value;
document.getElementById("p1").innerHTML = name + " " + sirnmae + " " + fullname + "<br>" + addr + "<br>" + mob;
}
</script>
</head>
<body>
<h3>Registration Form</h3>
<label>Enter Your Name:</label>
<input type="text" id="txt1"><br>
<label>Enter Your Sirname:</label>
<input type="text" id="txt2" onBlur="display()"><br>
<label>Your Name:</label>
<input type="text" id="txt3" readonly><br>
<label>Gender:</label>
<input type="radio" name="gen" value="Male">Male
<input type="radio" name="gen" value="Female">Female<br>
<label>Mobile:</label>
<input type="number" placeholder="Phone number" id="moblile" size="10"
onClick="alert('You should enter 10 digits')"><br>
<label>Address:</label>
<textarea cols="5" rows="6" id="address">Address</textarea><br>
<input type="submit" name="sub" value="Save" onClick="alldata()"><br>
<p id="p1"></p>
</body>
</html>