Fill blanks in the following HTML and JavaScript program. Sketch the web page an
ID: 3591085 • Letter: F
Question
Fill blanks in the following HTML and JavaScript program. Sketch the web page and discuss how this page works:
<HTML>
__________
<TITLE> Web Page with JavaScript </TITLE>81 HTML, JavaScri pt, and CSS© 2010 Taylor & Francis Group, LLC
<SCRIPT>
// Define a function to verify the name types on the form
function VerifyName(NameString) {
// If the name is empty, then give false
if (_________________ == "") {
return false
10 }
11 // Define 7 bad characters which are illegal in names
12 IllegalChar = "/, :;[]"
13 // For each of the 7 bad characters, check the typed name
14 // If a bad character has been found, then give false
15 for (i=0; i<=_____________; i++) {
16 aBadChar=_______________.charAt(i)
17 if (_________________.indexOf(aBadChar,0) >= 0) {
18 return false
19 }
20 }
21 // Otherwise (the above two errors are not found), give true
22 return ______________
23 }
24 // Define a function for the action after verify the name
25 function SubmitForm(____________) {
26 // If the verification returns false based on typed address
27 // then signals alert
28 // and move the cursor back to the name box and highlight it
29 // and return true (move on to the next task)
30 if (!VerifyName(form.______________.value)) {
31 alert("Ha-ha! Invalid name. Please input again!")
32 form.___________.focus()
33 ________________.name._____________()
34 ____________ false
35 }
36 return true
37 _____________
38 _____________
39 </HEAD>
40 _____________
41 <H3> SEND YOUR INFORMATION! </H3>
42 Please fill the form and submit it :
43 <BR>
44 <FORM
45 ACTION="mailto:MyEmail@U.edu" METHOD=POST>
46 Your Name: <BR>
47 <INPUT TYPE=TEXT NAME="name" SIZE=50> <BR>
48 Your Address: <BR>
49 <INPUT TYPE=TEXT __________="address" SIZE=50> <BR>
50 Your Request: <BR>
51 <INPUT __________=TEXT NAME="request" _________=100> <BR>82 Programming Languages for MIS© 2010 Taylor & Francis Group, LLC
52 <INPUT TYPE=SUBMIT ___________="Submit Information">
53 <INPUT TYPE=RESET VALUE="Reset the Form">
54 _________________
55 </BODY>
56 </HTML>
Explanation / Answer
<HTML>
<HEAD>
<TITLE> Web Page with JavaScript </TITLE>81 HTML, JavaScri pt, and CSS© 2010 Taylor & Francis Group, LLC
<SCRIPT>
// Define a function to verify the name types on the form
function VerifyName(NameString) {
// If the name is empty, then give false
if (NameString == "") {
return false
10 }
11 // Define 7 bad characters which are illegal in names
12 IllegalChar = "/, :;[]"
13 // For each of the 7 bad characters, check the typed name
14 // If a bad character has been found, then give false
15 for (i=0; i<= IllegalChar.length; i++) {
16 aBadChar= IllegalChar.charAt(i)
17 if ( NameString.indexOf(aBadChar,0) >= 0) {
18 return false
19 }
20 }
21 // Otherwise (the above two errors are not found), give true
22 return true;
23 }
24 // Define a function for the action after verify the name
25 function SubmitForm(form) {
26 // If the verification returns false based on typed address
27 // then signals alert
28 // and move the cursor back to the name box and highlight it
29 // and return true (move on to the next task)
30 if (!VerifyName(form.name.value)) {
31 alert("Ha-ha! Invalid name. Please input again!")
32 form.name.focus()
33 alert.name.value()
34 return false
35 }
36 return true
37 }
38 </SCRIPT>
39 </HEAD>
40 <BODY>
41 <H3> SEND YOUR INFORMATION! </H3>
42 Please fill the form and submit it :
43 <BR>
44 <FORM
45 ACTION="mailto:MyEmail@U.edu" METHOD=POST>
46 Your Name: <BR>
47 <INPUT TYPE=TEXT NAME="name" SIZE=50> <BR>
48 Your Address: <BR>
49 <INPUT TYPE=TEXT NAME="address" SIZE=50> <BR>
50 Your Request: <BR>
51 <INPUT TYPE=TEXT NAME="request" SIZE=100> <BR>82 Programming Languages for MIS© 2010 Taylor & Francis Group, LLC
52 <INPUT TYPE=SUBMIT VALUE="Submit Information">
53 <INPUT TYPE=RESET VALUE="Reset the Form">
54 </FORM>
55 </BODY>
56 </HTML>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.