0% found this document useful (0 votes)
4 views2 pages

User Registration Form Example

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

User Registration Form Example

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

12/18/24, 8:02 PM Example8.

html

ExamModel\[Link]

1 <html>
2 <head>
3 <title>Registration Form</title>
4 <link rel = "stylesheet" type = "text/css" href = "[Link]">
5 </head>
6 <body>
7 <script>
8 function handleSubmit() {
9 // Prevent the default form submission
10
11 var username = [Link]("username").value;
12 var password = [Link]("password").value;
13 var name = [Link]("name").value;
14 var sex;
15 var radios = [Link]("sex");
16 for (var i = 0; i < [Link]; i++) {
17 if (radios[i].checked) {
18 sex = radios[i].value;
19 break;
20 }
21 }
22
23 var Lang = [];
24 var checkboxes = [Link]("English");
25 for (var i = 0; i < [Link]; i++) {
26 if (checkboxes[i].checked) {
27 Lang = (checkboxes[i].value);
28 }
29 }
30
31 if (username =="" || password =="" || name == "") {
32 alert("Please fill all of the required fields before submitting the form");
33 return;
34 }
35
36 var page = `
37 <html>
38 <head>
39 <title>Details of ${username}</title>
40 <link rel="stylesheet" type="text/css" href="[Link]">
41 </head>
42 <body>
43 Username: ${username}<br><br>
44 Password: ${password}<br><br>
45 Name: ${name}<br><br>
46 Sex: ${sex}<br>
47 Language: ${Lang}<br>
48 </body>
49 </html>
50 `;
51

localhost:52817/13b091df-1266-4751-9688-14ec37dc1bbc/ 1/2
12/18/24, 8:02 PM [Link]

52 var newWindow = [Link]();


53 [Link](page);
54 [Link]();
55 }
56
57 </script>
58 <h1>Registration Form</h1>
59 <p>
60
61 Username: <input type = "text" id = "username" name = "username"><br><br>
62 Password: <input type = "password" id = "password" name = "password"><br><br>
63 Name:&emsp;<input type = "text" id="name" name = "name"><br><br>
64 Address: <input type = "text" id="Address" name = "Address"><br><br>
65 Zipcode: <input type = "text" id="Zipcode" name = "Zipcode"><br><br>
66 Email: <input type = "email" id="email" name = "email"><br><br>
67 Sex :<input type ="radio" id = "Male" name="sex" value="Male">Male<input type
="radio" id = "Female" name="sex" value="Female">Female<br><br>
68 Language Preference : <input type = "checkbox" id = "English" name = "English"
value = "English">English<input type = "checkbox" id = "NonEnglish" name = "English" value =
"Non English">Non English<br><br>
69 Write About Yourself(Optional)<br><textarea name="Write about Yourself"
id="Write" width="90" height="40"></textarea><br><br>
70 Select a option below to proceed: <select id = "option" name = "option">
71 <option value = "option1">Save</option>
72 <option value ="option2">Dont Save my Result</option><br><br>
73 <input type ="submit" value ="Submit" onclick="handleSubmit()">
74
75
76 </p>
77 </body>
78

localhost:52817/13b091df-1266-4751-9688-14ec37dc1bbc/ 2/2

You might also like