-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay75Formprops.html
42 lines (37 loc) · 1.12 KB
/
Day75Formprops.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Day 75</title>
</head>
<body>
<form name='headform'>
<input name='elem1' value='one'>
<input name='elem2' value='two'>
</form>
<form>
<input type="radio" name="age" value="10">
<input type="radio" name="age" value="20">
<select id="select">
<option value="apple">Apple</option>
<option value="pear">Pear</option>
<option value="banana">Banana</option>
</select>
</form>
<script>
console.log(document.forms.headform);// total form
let form=document.forms.headform;
let elem1=form.elements.elem1;
console.log(elem1.value);//one
//printing second form
console.log(document.forms[1]);
let form2=document.forms[1];
let radio=form2.elements.age;
console.log(radio[1]);
//select element
console.log(select.options);
alert(select.value);
</script>
</body>
</html>