Grade 10 HTML Program
Grade 10 HTML Program
How to make registration form in HTML using the following html tags with
attributes and script codes in JAVASCRIPT
HTML TAGS
1. <form></form> = The <form> element is a container for different types of input
elements, such as: text fields, checkboxes, radio buttons, submit
buttons, etc.
Type Description
3. The <label> Element Notice the use of the <label> element in the example above.
The <label> tag defines a label for many form elements.
The <label> element is useful for screen-reader users, because the screen-reader will
read out loud the label when the user focuses on the input element.
The <label> element also helps users who have difficulty clicking on very small
regions (such as radio buttons or checkboxes) - because when the user clicks the text
within the <label> element, it toggles the radio button/checkbox.
The for attribute of the <label> tag should be equal to the id attribute of the <input>
element to bind them together.
SCRIPT CODE
snippets
<script>
const resultsList= document.getElementById('results')
new
URLSearchParams(window.location.search).forEach((value,name)=>
{
resultsList.append(`${name}: ${value}`)
resultsList.append(document.createElement('br'))
})
</script>
Sample CODE:
A. This program will create a form and all the data entry or ELEMENTS will be posted to the other
page thru getElementsByID (initial entry of the user). Script getElelementsByID() function
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Enrolment Form</title>
</head>
<body>
<form action="result.html" method="GET">
<div>
<label>Name</label>
<input name="name">
</div>
<div>
<label>Password</label>
<input name="pwd" type="password">
</div>
<button>Submit</button>
</form>
</body>
</html>
B. This program will get the “RESULTS” or get elements or entry made by the user and display the
result in the page.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" conten="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Results</title>
</head>
<body>
<div id="results">
<a href="forms.html"> Back to Form <br></a>
<script>
const resultsList= document.getElementById('results')
new URLSearchParams(window.location.search).forEach((value,name)=>
{
resultsList.append(`${name}: ${value}`)
resultsList.append(document.createElement('br'))
})
</script>
</body>
</html>
ACTIVITY # 1:
Make a program will create a Registration Form or Enrollment Form containing the following
data:
Note: used proper initials stipulated besides each input element.
Username: user_name
Password: pwd_name
BIRTHDATE: bdate
Gender: gender
Male and Female
Submit: submit