SlideShare uma empresa Scribd logo
1 de 26
JavaScript Objects
    Session 12
Objectives
   Browser objects.
   Other browser objects.
DOM (Document Object Model)
   JavaScript allows you to access HTML elements and
    also change the existing structure of an HTML page.
    This can be done by using the different JavaScript
    properties and methods that follow the DOM
    specification. DOM is a technique used for accessing
    and manipulating HTML elements.
   DOM specifications are implemented by all the
    browsers to overcome incompatibility issues. W3C
    DOM specifications are divided into levels. The level
    1 specification of DOM was specification was in the
    year 1998. The current DOM specification is level 3.
Nodes
   The DOM is a blueprint through
    which can access of HTML elements
    and use JavaScript to dynamically
    manipulate them.
   The DOM reads all the elements
    contained in an HTML page. It treats
    the HTML elements as nodes.
   There are element nodes, attribute
    nodes and text nodes.
   Document is highest level node and
    text is lowest level node.
   All these nodes together form up a
    node tree and are related to each
    other.
Node properties
   All nodes present in the node hierarchy contain
    certain properties:
       nodeName: represents the name of the node. It
        contains the tag name of the HTML element in upper
        case.
       nodeValue: represents the text contained within the
        node. This property is only available for attribute
        nodes and not for document and element nodes.
       nodeType: represents the type of the node. For
        example, the document node, element node, and so
        on.
window object
   DOM provides various objects to access and manipulate
    HTML elements in a standard way. The window object is the
    top level object in the JavaScript hierarchy. The window
    object represents a browser window.
   window properties:
       defaultStatus: specifies or retrieves the default text to be
        displayed in the status bar of the browser window.
       closed: determines whether window is closed.
       document: represents an HTML document that contains
        different elements.
       history: contains history of the visited Uniform Resource
        Locators.
       location: contains the content of the specified URL.
       name: specifies or retrieves the name of the window.
window methods
   alert(): displays an alert box that states the message and an OK
    button.
   close(): closes the current window.
   confirm(): prompts a dialog box that display a message with the
    OK and Cancel button.
   creatPopup(): creates a pop-pup window.
   focus(): focuses the current windows.
   open(): opens specified file in a new browser window.
   prompt(): prompts a dialog box that accepts input from the user.
   print(): prints the content contained within the current element.
   setInterval(): repeatedly invokes a function or evaluates an
    expression after the specified time intervals (in milliseconds).
   setTimeout(): invokes a function after the specified time only
    once.
window object - Demo




Demo:
S12_Window.html
document object
   The document object is one of the basic JavaScript object. It
    represents the entire HTML document. It provides access to
    another elements such links, and so on. Each HTML page has
    only one document object. This object is created when you
    use the BODY element.
   Collections: the document object uses a collection of arrays
    that contain information about the document content.
       anchors[]: contains information about the anchors contained in
        a document.
       forms[]: contains information about the form contained in a
        document.
       images[]: contains information about the images contained in a
        document.
       links[]: contains information about the links contained in a
        document.
document object
   Properties of document object:
       body: provides accesses to the BODY element.
       cookie: specifies or retrieves all the cookies
        associated with the current document.
       domain: retrieves the domain name of the current
        document.
       title: specifies or retrieves the title of the
        document.
document object
   Methods of document object:
       close(): closes data stream and displays the data collected
        using the open() method.
       getElementById(): retrieves collection of HTML elements
        by using the specified ID.
       getElementsByName(): retrieves collection of HTML
        elements by using the specified name.
       getElementsByTagName(): retrieves collection of HTML
        elements with the specified tag name.
       open(): opens a stream to accept the output from
        write()or writeln() methods.
       write(): writes the text to HTML expression to a document.
document object - Demo




Demo: S12_Document.html
form object
   The form accepts input from the user and sends the user data for
    validation. JavaScript allows you to process and validate the form data. A
    single HTML document can contain multiple forms. The form object
    represents an HTML from. It is created when you use the FORM element.
   Properties of the form object:
        action: Sets or returns the value of the action attribute in a form.
        enctype: Sets or returns the value of the enctype attribute in a form
        length: Returns the number of elements in a form .
        method: Sets or returns the value of the method attribute in a form .
        name: Sets or returns the value of the name attribute in a form .
        target: Sets or returns the value of the target attribute in a form.
   Methods of the form object:
        submit(): Submits the form data to the server.
        reset(): resets the form data to their default values.
form object - Demo




Demo: S12_Form.html
frame object
   Frames allow you to view multiple screens simultaneously. The frame
    object represents the HTML frame. It is created when you use the
    FRAME element. A single browser window can contain multiple frames.
   Properties of the frame object:
      frameBorder: Sets or returns the value of the frame border

        attribute in a frame.
      marginHeight: Sets or returns the value of the margin height

        attribute in a frame
      longDesc: Sets or returns the value of the longdesc attribute in a
        frame
      marginWidth: Sets or returns the value of the marginwidth

        attribute in a frame
      name: Sets or returns the value of the name attribute in a frame

      noResize: Sets or returns the value of the noresize attribute in a

        frame
      src: Sets or returns the value of the src attribute in a frame
      id: Secifies or retrieves the ID of a frame.
frame object - Demo




Demo: S12_FrameDemo.html – S12_Frame.html
history object
   The history object is a part of the window object. It
    contains a set of URLs visited by a user in a browser
    window.
   The history object is an array that allows you to a
    particular URL by specifying its index number in the
    array. The length property allows you to determine
    the number of URLs in the history list.
   Methods of the history object:
       back(): Loads the previous URL in the history list.
       forward(): Loads the next URL in the history list
       go(): Loads a specific URL from the history list
history object - Demo




Demo: S12_History.html
navigator object
   The navigator object contains information about the
    browser used by the client. It allows you to retrieve
    information such as name, version number, and code
    name of browser.
   Properties of the navigator object:
       appCodeName: Returns the code name of the browser.
       appName: Returns the name of the browser .
       appVersion: Returns the version information of the browser.
       cookieEnable: Determines whether cookies are enabled in the
        browser .
       platform: Returns for which platform the browser is compiled
       userAgent: Returnsthe user-agent header sent by the browser
        to the server.
navigator object - Demo




Demo: S12_Navigator.html
location object
   The location object allows you to access complete
    information of URL loaded in browser window. It is a
    part of the window object. A single URL is composed of
    different positions such as the host name, port number,
    and so on.
   Properties of the navigator object:
       hash: Returns the anchor portion of a URL.
       host: Returns the hostname and port of a URL.
       hostname: Returns the hostname of a URL.
       href: Returns the entire URL.
       pathname: Returns the path name of a URL .
       port: Returns the port number the server uses for a URL.
       protocol: Returns the protocol of a URL.
       search: Returns the query portion of a URL.
location object
   Methods of the navigator object:
       assign(): Loads a new document.
       reload(): Reloads the current document.
       reload(): Replaces the current document
        with a new one.
location object - Demo




Demo: S12_Location.html
Summary
   DOM is a standard technique that allows accessing and
    manipulating HTML element through script.
   DOM provides various built-in objects to dynamically
    access HTML elements: Window object, document object,
    form object, frame object, history object, navigator
    object, location object.
   The window object is the top level object in the Javacript
    hierarchy. Window object represents the browser
    window.
   Document object is one of the basic Javascript object. It
    represents the entire HTML document.
Summary…
   Form accept input from the user and sends the
    user data for validation. Form object represents
    an HTML form.
   Frame allows to view multiple screen
    simultaneously. The Frame object represent the
    HTML frame.
   History object is a set of URLs visited by users in
    a browser window
Summary…
   Navigator object contain information about the
    browser used by the client.
   Location object allows to access complete
    information of the URL loaded in the browser
    window.

Mais conteúdo relacionado

Mais procurados

Introduction to objective c
Introduction to objective cIntroduction to objective c
Introduction to objective cSunny Shaikh
 
Building DSLs with the Spoofax Language Workbench
Building DSLs with the Spoofax Language WorkbenchBuilding DSLs with the Spoofax Language Workbench
Building DSLs with the Spoofax Language WorkbenchEelco Visser
 
3.1 javascript objects_DOM
3.1 javascript objects_DOM3.1 javascript objects_DOM
3.1 javascript objects_DOMJalpesh Vasa
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorialsMayank Jain
 
Functions, classes & objects in c++
Functions, classes & objects in c++Functions, classes & objects in c++
Functions, classes & objects in c++ThamizhselviKrishnam
 
Hibernate
Hibernate Hibernate
Hibernate Sunil OS
 
C# Advanced L03-XML+LINQ to XML
C# Advanced L03-XML+LINQ to XMLC# Advanced L03-XML+LINQ to XML
C# Advanced L03-XML+LINQ to XMLMohammad Shaker
 
C++ largest no between three nos
C++ largest no between three nosC++ largest no between three nos
C++ largest no between three noskrismishra
 
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...GeeksLab Odessa
 
Ios development
Ios developmentIos development
Ios developmentelnaqah
 

Mais procurados (20)

Introduction to JQuery
Introduction to JQueryIntroduction to JQuery
Introduction to JQuery
 
Introduction to objective c
Introduction to objective cIntroduction to objective c
Introduction to objective c
 
Using Dojo
Using DojoUsing Dojo
Using Dojo
 
Ajax
AjaxAjax
Ajax
 
Building DSLs with the Spoofax Language Workbench
Building DSLs with the Spoofax Language WorkbenchBuilding DSLs with the Spoofax Language Workbench
Building DSLs with the Spoofax Language Workbench
 
3.1 javascript objects_DOM
3.1 javascript objects_DOM3.1 javascript objects_DOM
3.1 javascript objects_DOM
 
Java basic understand OOP
Java basic understand OOPJava basic understand OOP
Java basic understand OOP
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorials
 
Functions, classes & objects in c++
Functions, classes & objects in c++Functions, classes & objects in c++
Functions, classes & objects in c++
 
Hibernate
Hibernate Hibernate
Hibernate
 
Java script
Java scriptJava script
Java script
 
C# Advanced L03-XML+LINQ to XML
C# Advanced L03-XML+LINQ to XMLC# Advanced L03-XML+LINQ to XML
C# Advanced L03-XML+LINQ to XML
 
C++ largest no between three nos
C++ largest no between three nosC++ largest no between three nos
C++ largest no between three nos
 
Local Storage
Local StorageLocal Storage
Local Storage
 
C++ classes
C++ classesC++ classes
C++ classes
 
Introduction to js (cnt.)
Introduction to js (cnt.)Introduction to js (cnt.)
Introduction to js (cnt.)
 
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
 
REST Basics
REST BasicsREST Basics
REST Basics
 
Ios development
Ios developmentIos development
Ios development
 
201005 accelerometer and core Location
201005 accelerometer and core Location201005 accelerometer and core Location
201005 accelerometer and core Location
 

Semelhante a 12. session 12 java script objects

INTRODUCTION TO CLIENT SIDE PROGRAMMING
INTRODUCTION TO CLIENT SIDE PROGRAMMINGINTRODUCTION TO CLIENT SIDE PROGRAMMING
INTRODUCTION TO CLIENT SIDE PROGRAMMINGProf Ansari
 
Javascript programming using the document object model
Javascript programming using the document object modelJavascript programming using the document object model
Javascript programming using the document object modelNicole Ryan
 
Global objects in Node.pdf
Global objects in Node.pdfGlobal objects in Node.pdf
Global objects in Node.pdfSudhanshiBakre1
 
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPTHSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPTAAFREEN SHAIKH
 
Introduction To Dojo
Introduction To DojoIntroduction To Dojo
Introduction To Dojoyoavrubin
 
9781305078444 ppt ch05
9781305078444 ppt ch059781305078444 ppt ch05
9781305078444 ppt ch05Terry Yoast
 
The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84Mahmoud Samir Fayed
 
Working with XML and JSON Serializing
Working with XML and JSON SerializingWorking with XML and JSON Serializing
Working with XML and JSON Serializingssusere19c741
 
Document Object Model
Document Object ModelDocument Object Model
Document Object ModelMayur Mudgal
 
FYBSC IT Web Programming Unit III Document Object
FYBSC IT Web Programming Unit III  Document ObjectFYBSC IT Web Programming Unit III  Document Object
FYBSC IT Web Programming Unit III Document ObjectArti Parab Academics
 
Xml dom & sax by bhavsingh maloth
Xml dom & sax by bhavsingh malothXml dom & sax by bhavsingh maloth
Xml dom & sax by bhavsingh malothBhavsingh Maloth
 

Semelhante a 12. session 12 java script objects (20)

INTRODUCTION TO CLIENT SIDE PROGRAMMING
INTRODUCTION TO CLIENT SIDE PROGRAMMINGINTRODUCTION TO CLIENT SIDE PROGRAMMING
INTRODUCTION TO CLIENT SIDE PROGRAMMING
 
Javascript programming using the document object model
Javascript programming using the document object modelJavascript programming using the document object model
Javascript programming using the document object model
 
Global objects in Node.pdf
Global objects in Node.pdfGlobal objects in Node.pdf
Global objects in Node.pdf
 
DOM and Events
DOM and EventsDOM and Events
DOM and Events
 
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPTHSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
 
Javascript.ppt
Javascript.pptJavascript.ppt
Javascript.ppt
 
Introduction To Dojo
Introduction To DojoIntroduction To Dojo
Introduction To Dojo
 
9781305078444 ppt ch05
9781305078444 ppt ch059781305078444 ppt ch05
9781305078444 ppt ch05
 
Dom structure
Dom structure Dom structure
Dom structure
 
Reversing JavaScript
Reversing JavaScriptReversing JavaScript
Reversing JavaScript
 
The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84
 
Javascript
Javascript Javascript
Javascript
 
Working with XML and JSON Serializing
Working with XML and JSON SerializingWorking with XML and JSON Serializing
Working with XML and JSON Serializing
 
Week8
Week8Week8
Week8
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
FYBSC IT Web Programming Unit III Document Object
FYBSC IT Web Programming Unit III  Document ObjectFYBSC IT Web Programming Unit III  Document Object
FYBSC IT Web Programming Unit III Document Object
 
Capstone ms2
Capstone ms2Capstone ms2
Capstone ms2
 
13488117.ppt
13488117.ppt13488117.ppt
13488117.ppt
 
13488117.ppt
13488117.ppt13488117.ppt
13488117.ppt
 
Xml dom & sax by bhavsingh maloth
Xml dom & sax by bhavsingh malothXml dom & sax by bhavsingh maloth
Xml dom & sax by bhavsingh maloth
 

Mais de Phúc Đỗ

15. session 15 data binding
15. session 15   data binding15. session 15   data binding
15. session 15 data bindingPhúc Đỗ
 
14. session 14 dhtml filter
14. session 14   dhtml filter14. session 14   dhtml filter
14. session 14 dhtml filterPhúc Đỗ
 
13. session 13 introduction to dhtml
13. session 13   introduction to dhtml13. session 13   introduction to dhtml
13. session 13 introduction to dhtmlPhúc Đỗ
 
11. session 11 functions and objects
11. session 11   functions and objects11. session 11   functions and objects
11. session 11 functions and objectsPhúc Đỗ
 
10. session 10 loops and arrays
10. session 10   loops and arrays10. session 10   loops and arrays
10. session 10 loops and arraysPhúc Đỗ
 
09. session 9 operators and statements
09. session 9   operators and statements09. session 9   operators and statements
09. session 9 operators and statementsPhúc Đỗ
 
08. session 08 intoduction to javascript
08. session 08   intoduction to javascript08. session 08   intoduction to javascript
08. session 08 intoduction to javascriptPhúc Đỗ
 
07. session 07 adv css properties
07. session 07   adv css properties07. session 07   adv css properties
07. session 07 adv css propertiesPhúc Đỗ
 
06. session 06 css color_andlayoutpropeties
06. session 06   css color_andlayoutpropeties06. session 06   css color_andlayoutpropeties
06. session 06 css color_andlayoutpropetiesPhúc Đỗ
 
05. session 05 introducing css
05. session 05   introducing css05. session 05   introducing css
05. session 05 introducing cssPhúc Đỗ
 
04. session 04 working withformsandframes
04. session 04   working withformsandframes04. session 04   working withformsandframes
04. session 04 working withformsandframesPhúc Đỗ
 
03. session 03 using lists and tables
03. session 03   using lists and tables03. session 03   using lists and tables
03. session 03 using lists and tablesPhúc Đỗ
 
02. session 02 working with html elements
02. session 02   working with html elements02. session 02   working with html elements
02. session 02 working with html elementsPhúc Đỗ
 
15. session 15 data binding
15. session 15   data binding15. session 15   data binding
15. session 15 data bindingPhúc Đỗ
 
01. session 01 introduction to html
01. session 01   introduction to html01. session 01   introduction to html
01. session 01 introduction to htmlPhúc Đỗ
 

Mais de Phúc Đỗ (15)

15. session 15 data binding
15. session 15   data binding15. session 15   data binding
15. session 15 data binding
 
14. session 14 dhtml filter
14. session 14   dhtml filter14. session 14   dhtml filter
14. session 14 dhtml filter
 
13. session 13 introduction to dhtml
13. session 13   introduction to dhtml13. session 13   introduction to dhtml
13. session 13 introduction to dhtml
 
11. session 11 functions and objects
11. session 11   functions and objects11. session 11   functions and objects
11. session 11 functions and objects
 
10. session 10 loops and arrays
10. session 10   loops and arrays10. session 10   loops and arrays
10. session 10 loops and arrays
 
09. session 9 operators and statements
09. session 9   operators and statements09. session 9   operators and statements
09. session 9 operators and statements
 
08. session 08 intoduction to javascript
08. session 08   intoduction to javascript08. session 08   intoduction to javascript
08. session 08 intoduction to javascript
 
07. session 07 adv css properties
07. session 07   adv css properties07. session 07   adv css properties
07. session 07 adv css properties
 
06. session 06 css color_andlayoutpropeties
06. session 06   css color_andlayoutpropeties06. session 06   css color_andlayoutpropeties
06. session 06 css color_andlayoutpropeties
 
05. session 05 introducing css
05. session 05   introducing css05. session 05   introducing css
05. session 05 introducing css
 
04. session 04 working withformsandframes
04. session 04   working withformsandframes04. session 04   working withformsandframes
04. session 04 working withformsandframes
 
03. session 03 using lists and tables
03. session 03   using lists and tables03. session 03   using lists and tables
03. session 03 using lists and tables
 
02. session 02 working with html elements
02. session 02   working with html elements02. session 02   working with html elements
02. session 02 working with html elements
 
15. session 15 data binding
15. session 15   data binding15. session 15   data binding
15. session 15 data binding
 
01. session 01 introduction to html
01. session 01   introduction to html01. session 01   introduction to html
01. session 01 introduction to html
 

Último

New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 

Último (20)

New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 

12. session 12 java script objects

  • 1. JavaScript Objects Session 12
  • 2. Objectives  Browser objects.  Other browser objects.
  • 3. DOM (Document Object Model)  JavaScript allows you to access HTML elements and also change the existing structure of an HTML page. This can be done by using the different JavaScript properties and methods that follow the DOM specification. DOM is a technique used for accessing and manipulating HTML elements.  DOM specifications are implemented by all the browsers to overcome incompatibility issues. W3C DOM specifications are divided into levels. The level 1 specification of DOM was specification was in the year 1998. The current DOM specification is level 3.
  • 4. Nodes  The DOM is a blueprint through which can access of HTML elements and use JavaScript to dynamically manipulate them.  The DOM reads all the elements contained in an HTML page. It treats the HTML elements as nodes.  There are element nodes, attribute nodes and text nodes.  Document is highest level node and text is lowest level node.  All these nodes together form up a node tree and are related to each other.
  • 5. Node properties  All nodes present in the node hierarchy contain certain properties:  nodeName: represents the name of the node. It contains the tag name of the HTML element in upper case.  nodeValue: represents the text contained within the node. This property is only available for attribute nodes and not for document and element nodes.  nodeType: represents the type of the node. For example, the document node, element node, and so on.
  • 6. window object  DOM provides various objects to access and manipulate HTML elements in a standard way. The window object is the top level object in the JavaScript hierarchy. The window object represents a browser window.  window properties:  defaultStatus: specifies or retrieves the default text to be displayed in the status bar of the browser window.  closed: determines whether window is closed.  document: represents an HTML document that contains different elements.  history: contains history of the visited Uniform Resource Locators.  location: contains the content of the specified URL.  name: specifies or retrieves the name of the window.
  • 7. window methods  alert(): displays an alert box that states the message and an OK button.  close(): closes the current window.  confirm(): prompts a dialog box that display a message with the OK and Cancel button.  creatPopup(): creates a pop-pup window.  focus(): focuses the current windows.  open(): opens specified file in a new browser window.  prompt(): prompts a dialog box that accepts input from the user.  print(): prints the content contained within the current element.  setInterval(): repeatedly invokes a function or evaluates an expression after the specified time intervals (in milliseconds).  setTimeout(): invokes a function after the specified time only once.
  • 8. window object - Demo Demo: S12_Window.html
  • 9. document object  The document object is one of the basic JavaScript object. It represents the entire HTML document. It provides access to another elements such links, and so on. Each HTML page has only one document object. This object is created when you use the BODY element.  Collections: the document object uses a collection of arrays that contain information about the document content.  anchors[]: contains information about the anchors contained in a document.  forms[]: contains information about the form contained in a document.  images[]: contains information about the images contained in a document.  links[]: contains information about the links contained in a document.
  • 10. document object  Properties of document object:  body: provides accesses to the BODY element.  cookie: specifies or retrieves all the cookies associated with the current document.  domain: retrieves the domain name of the current document.  title: specifies or retrieves the title of the document.
  • 11. document object  Methods of document object:  close(): closes data stream and displays the data collected using the open() method.  getElementById(): retrieves collection of HTML elements by using the specified ID.  getElementsByName(): retrieves collection of HTML elements by using the specified name.  getElementsByTagName(): retrieves collection of HTML elements with the specified tag name.  open(): opens a stream to accept the output from write()or writeln() methods.  write(): writes the text to HTML expression to a document.
  • 12. document object - Demo Demo: S12_Document.html
  • 13. form object  The form accepts input from the user and sends the user data for validation. JavaScript allows you to process and validate the form data. A single HTML document can contain multiple forms. The form object represents an HTML from. It is created when you use the FORM element.  Properties of the form object:  action: Sets or returns the value of the action attribute in a form.  enctype: Sets or returns the value of the enctype attribute in a form  length: Returns the number of elements in a form .  method: Sets or returns the value of the method attribute in a form .  name: Sets or returns the value of the name attribute in a form .  target: Sets or returns the value of the target attribute in a form.  Methods of the form object:  submit(): Submits the form data to the server.  reset(): resets the form data to their default values.
  • 14. form object - Demo Demo: S12_Form.html
  • 15. frame object  Frames allow you to view multiple screens simultaneously. The frame object represents the HTML frame. It is created when you use the FRAME element. A single browser window can contain multiple frames.  Properties of the frame object:  frameBorder: Sets or returns the value of the frame border attribute in a frame.  marginHeight: Sets or returns the value of the margin height attribute in a frame  longDesc: Sets or returns the value of the longdesc attribute in a frame  marginWidth: Sets or returns the value of the marginwidth attribute in a frame  name: Sets or returns the value of the name attribute in a frame  noResize: Sets or returns the value of the noresize attribute in a frame  src: Sets or returns the value of the src attribute in a frame  id: Secifies or retrieves the ID of a frame.
  • 16. frame object - Demo Demo: S12_FrameDemo.html – S12_Frame.html
  • 17. history object  The history object is a part of the window object. It contains a set of URLs visited by a user in a browser window.  The history object is an array that allows you to a particular URL by specifying its index number in the array. The length property allows you to determine the number of URLs in the history list.  Methods of the history object:  back(): Loads the previous URL in the history list.  forward(): Loads the next URL in the history list  go(): Loads a specific URL from the history list
  • 18. history object - Demo Demo: S12_History.html
  • 19. navigator object  The navigator object contains information about the browser used by the client. It allows you to retrieve information such as name, version number, and code name of browser.  Properties of the navigator object:  appCodeName: Returns the code name of the browser.  appName: Returns the name of the browser .  appVersion: Returns the version information of the browser.  cookieEnable: Determines whether cookies are enabled in the browser .  platform: Returns for which platform the browser is compiled  userAgent: Returnsthe user-agent header sent by the browser to the server.
  • 20. navigator object - Demo Demo: S12_Navigator.html
  • 21. location object  The location object allows you to access complete information of URL loaded in browser window. It is a part of the window object. A single URL is composed of different positions such as the host name, port number, and so on.  Properties of the navigator object:  hash: Returns the anchor portion of a URL.  host: Returns the hostname and port of a URL.  hostname: Returns the hostname of a URL.  href: Returns the entire URL.  pathname: Returns the path name of a URL .  port: Returns the port number the server uses for a URL.  protocol: Returns the protocol of a URL.  search: Returns the query portion of a URL.
  • 22. location object  Methods of the navigator object:  assign(): Loads a new document.  reload(): Reloads the current document.  reload(): Replaces the current document with a new one.
  • 23. location object - Demo Demo: S12_Location.html
  • 24. Summary  DOM is a standard technique that allows accessing and manipulating HTML element through script.  DOM provides various built-in objects to dynamically access HTML elements: Window object, document object, form object, frame object, history object, navigator object, location object.  The window object is the top level object in the Javacript hierarchy. Window object represents the browser window.  Document object is one of the basic Javascript object. It represents the entire HTML document.
  • 25. Summary…  Form accept input from the user and sends the user data for validation. Form object represents an HTML form.  Frame allows to view multiple screen simultaneously. The Frame object represent the HTML frame.  History object is a set of URLs visited by users in a browser window
  • 26. Summary…  Navigator object contain information about the browser used by the client.  Location object allows to access complete information of the URL loaded in the browser window.