Fix the following javascript errors use documentwrite thank

Fix the following javascript errors

use document.write

thank you

<!DOCTYPE html>
<html>
<head>
   <script language=\"javascript\" type=\"text/javascript\" src=\"script/assignment2.js\">
      
<title>Assignment 2</title>
<meta charset=\"UTF-8\">
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
       <a href=\"http://validator.w3.org/check/referer\"><img
src=\"http://www.w3.org/Icons/valid-xhtml10\"
alt=\"Valid XHTML 1.0!\" height=\"31\" width=\"88\" /></a>
</head>
  
  
  
  
  
  
  
  
  
  
<body>
<script language=\"javascript\" type=\"text/javascript\" src=\"script/assignment2.js\">
var students = [
[\'Jeff\', \'12345678\'],
[\'Kyle\', \'12345679\'],
[\'Steve\', \'12345671\']
]
//Function for checkbox label
function yesno(thecheckbox, thelabel) {
var checkboxvar = document.getElementById(thecheckbox);
var labelvar = document.getElementById(thelabel);
if (checkboxvar.checked == false) {
labelvar.innerHTML = \"Not required\";
} else {
labelvar.innerHTML = \"Required Field\";
}
}
//Validates number, input must be numerical + have 8 digits
function validateNumber() {
var num;
num = document.getElementById(\"number\").value;

if (isNaN(num) || num.length !== 8) {
alert(\"Please Enter a Number that is 8 numbers long\");
return false;
}
return true;
}
//validates Email
function validateEmail() {

var email = document.getElementById(\'email\');
var filter = /^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/;

if (!filter.test(email.value)) {
alert(\'Please provide a valid email address\');
return false;
}
return true;
}
//runs if validated, checks for corresponding name/number
function verification() {
if (validateNumber || validateEmail) {
var num;
num = document.getElementById(\"number\").value;
var name;
name = document.getElementById(\"name\");
for (int i = 0; i++; i < students.length())
if (students[i][0] == name)
if (students[i][1] == num)
alert(\'Welcome \' + name + \'!\');
}
}

</script>

<h1>Student Transaction Form</h1>
<p>Required fields marked with an asterisk *</p>
<form name=\"order\" method=\"post\" id=\"order\" action=\"http://webdevbasics.net/scripts/demo.php\">
<fieldset>
<legend>Student Transaction Form</legend>
<label for=\"Student Name\">&#42; Student Name:<input type=\"text\" name=\"student\" id=\"student\" required=\"required\" size=\"5\"></label><br><br>
<label for=\"Student number\">&#42; Student number:<input type=\"text\" name=\"number\" maxlength=\"8\" id=\"number\" required=\"required\" size=\"8\"></label><br><br>
<label for=\"Student Email\">&#42; Student Email:<input type=\"text\" name=\"email\" id=\"email\" required=\"required\" maxlength=\"10\" size=\"10\"></label><br><br>
</fieldset><br><br>
<label for=\"email confirmation\"> email confirmation:<input type=\"checkbox\" id=\"cbox1\" value=\"first_checkbox\"></label><br>
<input id=\"mySubmit\" type=\"Submit\" value=\"Continue\"><br>
<label>Select a Transaction</label>
<select id = \"myList\">
<option value = \"1\">Student transaction</option>
<option value = \"2\">Class transaction</option>
<option value = \"3\">Summer transaction</option>
</select>
</fieldset>
</form>
</body>
</html>

Solution

The only error in your javascript is the error of src.The path mentioned is incorrect for the assignment2 as you are using external javascript.

please mention the correct path for the assignment2 where you have placed it and there will be no errors in the javascript.

Fix the following javascript errors use document.write thank you <!DOCTYPE html> <html> <head> <script language=\
Fix the following javascript errors use document.write thank you <!DOCTYPE html> <html> <head> <script language=\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site