The Location Object

The location object contains information about the current URL. The location object is part of the window object and is accessed through the window.location property. Note: There is no public standard that applies to the location object, but all major browsers support it. Location Object Properties Property Description hash Sets or returns the anchor part (#) […]

The History Object

The history object contains the URLs visited by the user (within a browser window). The history object is part of the window object and is accessed through the window.history property. Note: There is no public standard that applies to the history object, but all major browsers support it. History Object Properties Property Description length Returns the […]

The Storage Object

The Storage object of the Web Storage API provides access to the session storage or local storage for a particular domain. This allows you to read, add, modify, and delete stored data items. Storage Object Properties and Methods Property/Method Description key(n) Returns the name of the nth key in the storage length Returns the number of […]

The Console Object

The Console object provides access to the browser’s debugging console. Console Object Methods Method Description assert() Writes an error message to the console if the assertion is false clear() Clears the console count() Logs the number of times that this particular call to count() has been called error() Outputs an error message to the console […]

HTML DOM Bold Object

Bold Object The Bold object represents an HTML <b> element. Access a Bold Object You can access a <b> element by using getElementById(): Example var x = document.getElementById(“myB”); Try it Yourself » Create a Bold Object You can create a <b> element by using the document.createElement() method: Example var x = document.createElement(“B”); Try it Yourself » Standard […]

HTML DOM Small Object

Small Object The Small object represents an HTML <small> element. Access a Small Object You can access a <small> element by using getElementById(): Example var x = document.getElementById(“mySmall”); Try it Yourself » Create a Small Object You can create a <small> element by using the document.createElement() method: Example var x = document.createElement(“SMALL”); Try it Yourself » Standard […]

HTML DOM Progress Object

Progress Object  The Progress Object is new in HTML5. The Progress object represents an HTML <progress> element. The <progress> element represents the progress of a task. Access a Progress Object You can access a <progress> element by using getElementById(): Example var x = document.getElementById(“myProgress”); Try it Yourself » Create a Progress Object You can create a […]

HTML DOM Strong Object

Strong Object The Strong object represents an HTML <strong> element. Access a Strong Object You can access a <strong> element by using getElementById(): Example var x = document.getElementById(“myStrong”); Try it Yourself » Create a Strong Object You can create a <strong> element by using the document.createElement() method: Example var x = document.createElement(“STRONG”); Try it Yourself » Standard […]

HTML DOM Summary Object

Summary Object  The Summary Object is new in HTML5. The Summary object represents an HTML <summary> element. Note: The <summary> element is currently only supported in Chrome, Safari 6+ and Opera 15+. Access a Summary Object You can access a <summary> element by using getElementById(): Example var x = document.getElementById(“mySummary”); Try it Yourself » Create a Summary […]

HTML DOM Mark Object

Mark Object  The Mark Object is new in HTML5. The Mark object represents an HTML <mark> element. Note: The <mark> element is not supported in Internet Explorer 8 and earlier versions. Access a Mark Object You can access a <mark> element by using getElementById(): Example var x = document.getElementById(“myMark”); Try it Yourself » Create a Mark Object […]

HTML DOM Div Object

Div Object The Div object represents an HTML <div> element. Access a Div Object You can access a <div> element by using getElementById(): Example var x = document.getElementById(“myDIV”); Try it Yourself » Create a Div Object You can create a <div> element by using the document.createElement() method: Example var x = document.createElement(“DIV”); Try it Yourself » Div […]

HTML DOM Aside Object

Aside Object  The Aside Object is new in HTML5. The Aside object represents an HTML <aside> element. Note: The <aside> element is not supported in Internet Explorer 8 and earlier versions. Access an Aside Object You can access an <aside> element by using getElementById(): Example var x = document.getElementById(“myAside”); Try it Yourself » Create an Aside Object […]

JavaScript Objects

Real Life Objects, Properties, and Methods In real life, a car is an object. A car has properties like weight and color, and methods like start and stop: Object Properties Methods car.name = Fiat car.model = 500 car.weight = 850kg car.color = white car.start() car.drive() car.brake() car.stop() All cars have the same properties, but the property values differ from car to car. All […]