Advance Web Programming Assignment
Advance Web Programming Assignment
ICTU2023705 www.ictuniversity.org
nang.victorin@ictuniversity.edu.cm
696201277/681165783 Course Tutor: Dr Djousse Hugues
PART I
1) Undefined means a variable has been declared but has has yet not been assigned whereas
null is an empty value that shows that a variable has no value.
2) DOM stands for Document Object Model, it is a programming interface for web
documents. It represents the page so that programs can change the document structure,
style, and content. The DOM represents the document as nodes and objects; that way,
programming languages can interact with the page.
4) In JavaScript the typeof operator returns the data type of the operand in the form of a string.
The operand can be any object, function, or variable.
5) Undeclared variables are variables that have not been defined in the current scope, while
undefined variables are those that have been declared but not given a value.
6) We can use the document.cookie property to create, read and delete cookies like for
example; document.cookie = "username=John Doe";
7) A prompt box is often used if you want the user to input a value before entering a page. It
consists of two buttons, OK and Cancel.
As such document.cookie will return all cookies in one string much like: cookie1=value;
cookie2=value; cookie 3=value;
Nang Victorin
NANG VICTORIN ADVANCE WEB PROGRAMMING
ICTU2023705 www.ictuniversity.org
nang.victorin@ictuniversity.edu.cm
696201277/681165783 Course Tutor: Dr Djousse Hugues
9) To delete a cookie in JavaScript you don’t have to specify a cookie value you just have to
set the parameter to a past date like for example; document.cookie = "username=;
expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
PART II
1) The CSS style of an element can be changed using the setAttribute method, specifying the
CSS property and its value.
2) To change existing classes with one or more new classes, set the className attribute:
document.getElementById(“MyElement”).className = “MyClass”;
5) An attribute is the initial state when rendered in the document object model whereas a
property is the current state. In most cases, attributes and properties are kept in-sync
automatically. In simple Attributes are defined by html whereas properties are defined by
the DOM.
6) From the DOM, users can access HTML elements in five different ways which are;
Get HTML element by Id, Get HTML element by className, Get HTML element by
Name, Get HTML element by tagName, Get HTML element by CSS Selector.
Nang Victorin
NANG VICTORIN ADVANCE WEB PROGRAMMING
ICTU2023705 www.ictuniversity.org
nang.victorin@ictuniversity.edu.cm
696201277/681165783 Course Tutor: Dr Djousse Hugues
7) To convert a string from a base to an integer in JavaScript you have to use the function
parseInt(), Number(), and Unary operator(+) function is used in javascript. parseInt()
function returns Nan(not a number) when the string doesn’t contain number.
Nang Victorin