Question 1: To be answered in (30) Minutes [ ] / 10 M arks Consider the followin
ID: 3868427 • Letter: Q
Question
Question 1:
To be answered in (30) Minutes [ ] / 10 Marks
Consider the following HTML document:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>GPA Calculator </title>
<link rel="stylesheet" type="text/css" href="question01.css">
<script>
var counter = 1;
var limit = parseInt( prompt("How Many Courses Did you Take ? ", "Number of courses"));
function addGPAField(divName){
var newdiv = document.createElement('div');
// write your JavaScript Code
// add your JavaScript code here to add new field when user need to add new courses
document.getElementById(divName).appendChild(newdiv);
}
function getGPAValues(){
// write your JavaScript Code
}
</script>
</head>
<body>
<div class="form">
<div >
<h1> College GPA Calculator </h1>
</div>
<form method="POST" >
<div id="dynamicInput" >
<label>
Course 1 - Grade
</label>
<select id="grade1" >
<option value=0>Not selected</option>
<option value=5>A+</option>
<option value=4.75>A</option>
<option value=4.5>B+</option>
<option value=4>B</option>
<option value=3.5>C+</option>
<option value=3>C</option>
<option value=2.5>D+</option>
<option value=2>D</option>
<option value=1>F</option>
</select>
<label>Credits </label>
<select id="credite1">
<option value=0>Not selected</option>
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5>5</option>
</select>
</div>
<br>
<input type="button" value="Add another Course Grade" class="button">
<br>
<input type="button" value="Get GPA" class="button button-block">
</form>
<br>
<div id="showGPA" ></div>
</div>
</body>
</html>
This document displays prompt asking for the number of courses:
0
The utility of this page is to.
3
1
4
2
You are asked to write a JavaScript code that calculates GPA given a set of courses results. Allow the user to choose how many courses and then allow the user to add new course. When the user click get GPA button the code generate the cumulative GPA =(
If user did not select a grade, then alert message will show (Some grades have not been given).
Question 2:
To be answered in (30) Minutes [ ] / 10 Marks
Consider the following HTML document:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> Bank Account opening </title>
<link rel="stylesheet" type="text/css" href="style.css">
<script>
// MAke sure user gives name (not a number or other input) and must not enter space
// ID must be a number and with 10 digit
// Your age should be more than 18 years
// You should be living/residing in KSA
var pictures = [ "GetCaptcha1", "GetCaptcha2", "GetCaptcha3", "GetCaptcha4", "GetCaptcha5", "GetCaptcha6", "GetCaptcha7" ];
var code =[7393975,1104826,2752018,0028547,7962808,3174185,8051045] ;
// pick a random image and corresponding description then modify
// the img element in the document's body
function refreshCaptcha()
{
// Write your Javascript code here
} // end function pickImage
// registers iconImg's click event handler
function start()
{
// Write your Javascript code here
} // end function start
window.addEventListener( "load", start, false );
</script>
</head>
<body>
<div class="form" action="form.php">
<h1> Customer Information </h1>
<p> <span> Fields marked with (*) are required. </span> </p>
<form method = "post" action = "#" >
<p>
<label>Full Name<span class="req">*</span>: </label>
<input type="text" id="fullname" name="fullname" placeholder="Full Name" required/>
</p>
<p>
<label> Gender: </label>
<input type="radio" name="gender" value="male" /> Male
<input type="radio" name="gender" value="female"/> Female
</p>
<!-- Expiry Date* -->
<p>
<label>
ID *: </label> <input type="number" id="id" name="id" placeholder="ID number" required/>
</p>
<p>
<label>
Nationality:
</label>
<select name="nationality" id ="nationality">
<option value="saudi">Saudi</option>
<option value="kuwaiti">Kuwaiti</option>
<option value="bahraini">Bahraini</option>
<option value="egyptian">Egyptian</option>
<option value="sudanese">Sudanese</option>
<option value="omani">Omani</option>
<option value="jordanian">Jordanian</option>
<option value="Emirati">Emirati</option>
</select>
</p>
<p>
<label>Date of birth: </label>
<input type = "date" id="Dob"/>
(yyyy-mm-dd) <span id="age"> </span>
</p>
<p>
<label>Email<span class="req">*</span>: </label>
<input type = "email" placeholder = "name@domain.com"
required /> (name@domain.com) <span id="email"> </span>
</p>
<p>
<label>
Nature Of Stay In Kingdom<span class="req">*</span>: </label>
<input type="radio" id="Resident" name="stayType" value="Resident" required> Resident
<input type="radio" id="nonResident" name="stayType" value="nonResident" required> Non Resident <br>
</p>
<p>
<label> Enter the code <span class="req">*</span>: </label>
<img id = "CAPTCHA" src="" alt = "CAPTCHA">
<input type="text" id="givenCAPTCHA" name="givenCAPTCHA" required/>
<a href="#">Change Image</a>
</p>
<p>
<input type = "submit" value = "Submit" class="button" />
<input type = "reset" value = "Clear" class="button" />
</p>
</form>
<div id="txt"> </div>
</div>
</body>
</html>
If I put Abdulrahman in Full name and click submit:
You should Enter ID with 10 digits
A random generation of a code (CAPTCHA) as the following:
You are asked to write a JavaScript code that validates a form for opening a bank account. This form should consider the following:
Make sure user gives name (not a number or other input) and must not enter space
ID must be a number and with 10 digit
Age should be more than 18 years
You should be living/residing in KSA
A random generation of number images (CAPTCHA) to determine whether or not the user is human. Allow the user to change the image and then check if the given number is correct.
Question 1:
To be answered in (30) Minutes [ ] / 10 Marks
Consider the following HTML document:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>GPA Calculator </title>
<link rel="stylesheet" type="text/css" href="question01.css">
<script>
var counter = 1;
var limit = parseInt( prompt("How Many Courses Did you Take ? ", "Number of courses"));
function addGPAField(divName){
var newdiv = document.createElement('div');
// write your JavaScript Code
// add your JavaScript code here to add new field when user need to add new courses
document.getElementById(divName).appendChild(newdiv);
}
function getGPAValues(){
// write your JavaScript Code
}
</script>
</head>
<body>
<div class="form">
<div >
<h1> College GPA Calculator </h1>
</div>
<form method="POST" >
<div id="dynamicInput" >
<label>
Course 1 - Grade
</label>
<select id="grade1" >
<option value=0>Not selected</option>
<option value=5>A+</option>
<option value=4.75>A</option>
<option value=4.5>B+</option>
<option value=4>B</option>
<option value=3.5>C+</option>
<option value=3>C</option>
<option value=2.5>D+</option>
<option value=2>D</option>
<option value=1>F</option>
</select>
<label>Credits </label>
<select id="credite1">
<option value=0>Not selected</option>
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5>5</option>
</select>
</div>
<br>
<input type="button" value="Add another Course Grade" class="button">
<br>
<input type="button" value="Get GPA" class="button button-block">
</form>
<br>
<div id="showGPA" ></div>
</div>
</body>
</html>
This document displays prompt asking for the number of courses:
0
The utility of this page is to.
3
1
4
2
You are asked to write a JavaScript code that calculates GPA given a set of courses results. Allow the user to choose how many courses and then allow the user to add new course. When the user click get GPA button the code generate the cumulative GPA =(
If user did not select a grade, then alert message will show (Some grades have not been given).
Question 2:
To be answered in (30) Minutes [ ] / 10 Marks
Explanation / Answer
form.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> Bank Account opening </title>
<link rel="stylesheet" type="text/css" href="style.css">
<script>
var pictures = [ "GetCaptcha1", "GetCaptcha2", "GetCaptcha3", "GetCaptcha4", "GetCaptcha5", "GetCaptcha6", "GetCaptcha7" ];
var code =[7393975,1104826,2752018,0028547,7962808,3174185,8051045] ;
function checkInput()
{
}
function start()
{
var dob = document.forms["ProcessInfo"]["Dob"].value;
var pattern = 0?6[/.-](?:30|2[0-9]|1[1-9])[/.-]1992|(?:(?:0?9|11)[/.-](?:30|[12][0-9]|0?[1-9])|
(?:0?[78]|1[02])[/.-](?:3[01]|[12][0-9]|0?[1-9]))[/.-]1992|0?6[/.-](?:1[01]|0?[1-9])
[/.-]2010|(?:0?2[/.-](?:[12][0-9]|0?[1-9])|0?4[/.-](?:30|[12][0-9]|0?[1-9])|0?
[135][/.-](?:3[01]|[12][0-9]|0?[1-9]))[/.-]2010|(?:0?2[/.-](?:[12][0-9]|0?[1-9])|
(?:0?[469]|11)[/.-](?:30|[12][0-9]|0?[1-9])|(?:0?[13578]|1[02])[/.-](?:3[01]|
[12][0-9]|0?[1-9]))[/.-](?:200[0-9]|199[3-9]);
if (dob == null || dob == "" || !pattern.test(dob)) {
alert("Invalid date of birth ");
return false;
}
else {
return true
}
}
window.addEventListener( "load", start, false );
</script>
</head>
<body>
<div class="form" action="form.php">
<h1> Customer Information </h1>
<p> <span> Fields marked with (*) are required. </span> </p>
<form method = "post" action = "#" name="ProcessInfo">
<p>
<label>Full Name<span class="req">*</span>: </label>
<input type="text" id="fullname" name="fullname" pattern="^S+w{5,32}S{1,}" title="Enter name without space" placeholder="Full Name" required/>
</p>
<p>
<label> Gender: </label>
<input type="radio" name="gender" value="male" /> Male
<input type="radio" name="gender" value="female"/> Female
</p>
<!-- Expiry Date* -->
<p>
<label>
ID *: </label> <input type="number" id="id" pattern="/[2-9]{2}d{8}/" title="Enter minimum 10 numbers" name="id" placeholder="ID number" required/>
</p>
<p>
<label>
Nationality:
</label>
<select name="nationality" id ="nationality">
<option value="saudi">Saudi</option>
<option value="kuwaiti">Kuwaiti</option>
<option value="bahraini">Bahraini</option>
<option value="egyptian">Egyptian</option>
<option value="sudanese">Sudanese</option>
<option value="omani">Omani</option>
<option value="jordanian">Jordanian</option>
<option value="Emirati">Emirati</option>
</select>
</p>
<p>
<label>Date of birth: </label>
<input type = "date" id="Dob"/>
(yyyy-mm-dd) <span id="age"> </span>
</p>
<p>
<label>Email<span class="req">*</span>: </label>
<input type = "email" placeholder = "name@domain.com"
required /> (name@domain.com) <span id="email"> </span>
</p>
<p>
<label>
Nature Of Stay In Kingdom<span class="req">*</span>: </label>
<input type="radio" id="Resident" name="stayType" value="Resident" required> Resident
<input type="radio" id="nonResident" name="stayType" value="nonResident" required> Non Resident <br>
</p>
<p>
<label> Enter the code <span class="req">*</span>: </label>
<img id = "CAPTCHA" src="" alt = "CAPTCHA">
<input type="text" id="givenCAPTCHA" name="givenCAPTCHA" required/>
<a href="#">Change Image</a>
</p>
<p>
<input type = "submit" value = "Submit" class="button" />
<input type = "reset" value = "Clear" class="button" />
</p>
</form>
<div id="txt"> </div>
</div>
</body>
</html>
form.php
<?php
session_start();
if ($_POST["code"] != $_SESSION["code"] OR $_SESSION["code"]=='') {
echo '<strong>Incorrect verification code.</strong>';
} else {
echo '<strong>Verification successful.</strong>';
};
?>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.