Professional Documents
Culture Documents
IT230 - Assignment 2
IT230 - Assignment 2
Web Technologies
IT230
Assignmen
Instructions:
t2
You must submit two separate copies (one Word file and one PDF file) using the Assignment Template on
Blackboard via the allocated folder. These files must not be in compressed format.
It is your responsibility to check and make sure that you have uploaded both the correct files.
Zero mark will be given if you try to bypass the SafeAssign (e.g. misspell words, remove spaces between
words, hide characters, use different character sets, convert text into image or languages other than English
or any kind of manipulation).
Email submission will not be accepted.
You are advised to make your work clear and well-presented. This includes filling your information on the
cover page.
You must use this template, failing which will result in zero mark.
You MUST show all your work, and text must not be converted into an image, unless specified otherwise by
the question.
Late submission will result in ZERO mark.
The work should be your own, copying from students or other resources will result in ZERO mark.
Notes:
1. Copy and paste your script as your answer for this question. DON’T take
screen shot for your HTML and JS script. It must be editable script.
2. Provide a screenshot of your output. The alert box should display your
name and your ID.
<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">Click</button>
<script>
function myFunction() {
alert("Amal Alammari 190077037");
}
</script>
</body>
</html>
Pg. 3 Question OneQuestion One
1 Mark
Learning
Outcome(s): Question Two
Develop dynamic Write a script that shows the exact day and time? You required to do the
web pages using followings:
JavaScript. 1. Copy and paste your script as your answer for this question. DON’T take
screen shot for your HTML script. It must be editable script.
2. Full screenshot of your output
<!DOCTYPE html>
<html>
<head>
<title> The Date is
</title>
</head>
<script>
var today =new
Date();
var Day= today.getDay();
var dayList =
["Sunday","Monday","Tuesday","Wednesday","Friday","Saturday"];
document.write("Today is: " + dayList[Day]);
document.write("<br/>");
2.5 Marks
Learning
Outcome(s): Question Three
Develop dynamic
Using JavaScript DOM, access and modify following HTML elements
web pages using
according to the tasks listed below:
JavaScript.
<h1 id="h1id"> KSA </h1>
<h2 id="h2id"> KSA </h2>
<img id="img" src="seu.jpg" width="400px" height="150px">
Tasks:
Notes:
3. Copy and paste your script as your answer for this question. DON’T take
screen shot for your HTML and JS script. It must be editable script.
4. Provide a screenshot of your output
Hint: this is how the webpage should look like before and after executing the
required tasks:
Before After
Pg. 6 Question OneQuestion One
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<script>
document.getElementById("img").width = "150";
document.getElementById("h1id").style.color = "green";
document.getElementById("h2id").innerHTML = "SEU";
</script>
</body>
</html>
Pg. 7 Question OneQuestion One
1 Mark
Learning
Outcome(s): Question Four
Design XML Provide an xml file that references the following Document Type Definition:
Schemas and (*You may use your own data).
documents. <?xml version=“1.0”?>
<!DOCTYPE student [
<!ELEMENT student (name, ID, branch)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT ID (#PCDATA)>
<!ELEMENT branch (#PCDATA)>
]
2 Marks
Learning
Outcome(s): Question Five
Develop dynamic Write the HTML and the JavaScript code that validates a numeric input. The
web pages using number entered by the user should be between 1 and 10.
JavaScript. When the user enters an invalid value, the background of the input will be red
and the sentence “The number should be between 1 and 10” will be displayed
in red just after the form.
Notes:
1. Copy and paste your script as your answer for this question. DON’T take
screen shot for your HTML script. It must be editable script.
2. Provide a screenshot of your output
<!DOCTYPE html>
<html>
<head>
<title>the answer of question 5</title>
</head>
<body>
<label>Number: </label>
<input type="number" id="number"></br>
<button type="button" onclick="validateNumber()">register</button>
<p id="output"></p>
<script type="text/javascript">
Pg. 9 Question OneQuestion One
function validateNumber(){
var number=document.getElementById("number");
var x=number.value;
var output=document.getElementById("output");
if ( x < 1 || x > 10)
{
output.innerHTML = "The number should be between 1 and 10";
output.style.color = "red";
number.style.backgroundColor= "red";
}
else
{
output.innerHTML = "Valid Input";
output.style.color = "black";
number.style.backgroundColor=
"white";
}
}
</script>
</body>
</html>