Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
9 views

Advance Web Programming Assignment

The document discusses JavaScript concepts like DOM, cookies, and file reading/writing. It also covers CSS manipulation and different ways to select HTML elements from the DOM. Various JavaScript loops, data types, and parsing methods are examined as well.

Uploaded by

Nang Victorin
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Advance Web Programming Assignment

The document discusses JavaScript concepts like DOM, cookies, and file reading/writing. It also covers CSS manipulation and different ways to select HTML elements from the DOM. Various JavaScript loops, data types, and parsing methods are examined as well.

Uploaded by

Nang Victorin
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

NANG VICTORIN ADVANCE WEB PROGRAMMING

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.

3) JavaScript was developed by Netscape Communications Corporation, a software company


founded in 1994.

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.

Syntax: typeof operand

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.

8) A cookie can be read in JavaScript using the command; let x = document.cookie;

As such document.cookie will return all cookies in one string much like: cookie1=value;
cookie2=value; cookie 3=value;

Student in Master of Information


System Security

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”;

3) JavaScript supports the (for, for/in, for/of, while, do/while) loops.

4) The syntax; readFile(path, format, callBackFunc) is used to read a file in JavaScript.


Whereas the syntax; writeFile(path, inputData, callBackFunction) is used to write a file in
JavaScript.

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.

Student in Master of Information


System Security

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.

Student in Master of Information


System Security

Nang Victorin

You might also like