document (JavaScript 1.0)

Represents an HTML or XML document.

Properties & Events

KeyDescriptionAvailability
alinkcolorSpecifies the color of active links.
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera 7.0
anchorsArray of all of the Anchor objects in a document.
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera 7.0
appletsArray of all of the Applet objects in a document.
chrome 1.0safari 1.0Firefox 1.0ie 4.0opera 7.0
bgcolorBackground color of a document.
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera 7.0
bodyReference to the body or frameset element.
chrome 1.0safari 1.0Firefox 1.0ie 4.0opera 7.0
cookieValue of the cookie that the browser has set for the document.
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera 7.0
documentelementRoot element in a document.
chrome 1.0safari 1.0Firefox 1.0ie 5.0opera 7.0
domainInternet domain of the document.
chrome 1.0safari 1.0Firefox 1.0ie 4.0opera 7.0
embedsArray of all embedded objects in the document.
chrome 1.0safari 1.0Firefox 1.0ie 4.0opera 7.0
fgcolorFont color of the document text.
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera 7.0
formsArray of all of the Forms in the document.
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera 7.0
heightHeight of the entire HTML document (in pixels).
chrome 1.0safari 1.0Firefox 1.0ie ??opera 7.0
imagesArray of Image objects in the document.
chrome 1.0safari 1.0Firefox 1.0ie 4.0opera 7.0
implementationObject that specifies whether or not and at what level the browser supports the specified feature.
chrome 1.0safari 1.0Firefox 1.0ie 6.0opera 7.0
lastmodifiedDate that the document was last modified.
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera 7.0
linkcolorColor of the unvisited links in the document.
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera 7.0
linksArray of all of the links in the document.
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera 7.0
pluginsArray of plugins installed in the browser.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 7.0
referrerURL of the referring document.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 7.0
stylesheetsArray of all of the styleSheets in the document.
chrome 1.2safari 1.2Firefox 1.0ie 4.0opera 7.0
titleTitle of the document.
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera 7.0
vlinkcolorColor of visited links.
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera 7.0
widthWidth of the HTML document (in pixels).
chrome 1.0safari 1.0Firefox 1.0ie ??opera 7.0
onclickFires when the element is clicked.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
ondblclickFires when the element is double-clicked.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
onkeydownFires when a user presses down on a key while the element has focus.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
onkeypressFires when a user presses a key or holds down the key while the element has focus.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
onkeyupFires when a user releases a key while the element has focus.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
onmousedownFires when a user clicks down on the mouse button while the element has focus.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
onmousemoveFires when the mouse moves while the pointer over the element.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
onmouseoutFires when the mouse pointer moves off of the element.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
onmouseoverFires when the mouse pointer moves over the element.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0
onmouseupFires when the user releases the mouse button while the element has focus.
chrome 1.0safari 1.0Firefox 1.0ie 2.0opera 4.0

Result from the Online TryIt-Editor
chrome 1.0safari 1.0Firefox 1.0ie 3.0opera 4.0

Examples having uses of: 'document'

2 votes
9k views

JavaScript Prompt Object

Prompt box used for taking input from user. If you click on ok button then it return input value else it return null
1 votes
8k views

jQuery AJAX Introduction

The jQuery load method is a simple to use AJAX (Asynchronous JavaScript and XML.) function. That enables you to load ajax content with one line of code. AJAX is a technique for creating better and more interactive web applications and we at webgrid.com are using ajax with jQuery alot to make this web page better!
0 votes
8k views

JavaScript setTimeout and clearTimeout

JavaScript clearTimeout function enables you to stop the timer event started by the JavaScript setTimeout function. When you apply the setTimeout function using a recursive loop over the JavaScript function by specifying the time delay then it calls the function continuously after equal intervals of time.
9 votes
8k views

JavaScript Introduction

JavaScript is a client side scripting language that can make your webpage intaractive and JavaScript can be embbeded into your static HTML webpage directly.
1 votes
7k views

HTML5 Drag and Drop

Now HTML 5 came up with a Drag and Drop (DnD) API that brings native DnD support to the browser making it much easier to code up. HTML 5 DnD is supported by all the major browsers like Chrome, Firefox 3.5 and Safari.
1 votes
7k views

jQuery Selectors Basics

jQuery selectors allows us to select HTML elements and manipute them as a group or as a single object. In jQuery it's common that selectors start with dollar sign and parentheses. Syntax:- $.(selector).methodName();
3 votes
7k views

jQuery DOM Traversing

jQuery is a very powerful tool which provides a variety of traversal methods to help us select elements in a document randomly as well as in sequential method. In other words, we can say that most of the traversing methods are used to find elements from the documents.
4 votes
7k views

jQuery Hide & Show

With jQuery, you can hide and show HTML elements with the hide and show methods
3 votes
7k views

jQuery Introduction

jQuery is a cross-browser JavaScript library designed to simplify the client-side scripting of HTML. jQuery is an open source JavaScript library that simplifies the interactions between an HTML document, or more precisely the Document Object Model (DOM), and JavaScript.
3 votes
7k views

HTML5 geoLocation

The HTML5 Geolocation API is used to get the geographical position of a user. NOTE: Since this can compromise user privacy, the position is not available unless the user approves it.
1 votes
7k views

HTML5 canvas

The <canvas> tag is used to draw graphics, on the fly, via scripting (usually JavaScript). The <canvas> tag is only a container for graphics, you must use a script to actually draw the graphics.
4 votes
7k views

jQuery ajaxStart & ajaxComplete

jQuery ajaxStart and ajaxComplete are two functions are very useful to show the graphics while the data is loading from server. The ajaxStart method works while the server fullfilling the service asked to it. The ajaxComplete method is called when the server fulfilled the request.
1 votes
7k views

jQuery AJAX Life Cycle

jQuery AJAX life cycle demonstration. This is a demonstration of the methods ajaxStart, ajaxSend, ajaxComplete, ajaxStop, and ajaxSuccess that are triggered when load method is called.
1 votes
6k views

jQuery Plugin Introduction

By extending jQuery, you create reusable components that can be used on any web page. Your code is encapsulated and there is less risk that you will use the same function names elsewhere.
2 votes
6k views

jQuery Animate Introduction

jQuery animate method is very powerful API to manipulate html elements and add animation functionality. The use of animate function is very simple.
1 votes
6k views

jQuery Event Introduction

Introduction to jQuery and how to attach a handler to one or more events for all elements that match the selector.
0 votes
6k views

jQuery Support

jQuery.support is a collection of properties that represent the presence of different browser features or bugs. Primarily intended for jQuery's internal use; specific properties may be removed when they are no longer needed internally to improve page startup performance.
0 votes
6k views

HTML Script

The <script> tag is used to define a client-side script, such as a JavaScript. The script element either contains scripting statements or it points to an external script file through the src attribute.
0 votes
6k views

JavaScript Click and Mouse Events

Javascript Events are the actions which are detected by the javascript when they are fired.
2 votes
6k views

jQuery - Get CSS information

Using the css property we can get the simple CSS property value of an attribute.
3 votes
6k views

jQuery Attributes

Some of the most basic components we can manipulate when it comes to DOM elements are the properties and attributes assigned to those elements
3 votes
6k views

jQuery Basic Manipulation

jQuery provides methods to manipulate documents in efficient way. You do not need to write big code to modify the value of any element's attribute or to extract HTML code from a paragraph or division.
1 votes
6k views

Create JavaScript Cookie

Cookies are stored by the web browser. They allow you to store particular information about a user and retrieve it every time they visit your pages. Each user has their own unique set of cookies
1 votes
5k views

JavaScript Statement introduction

JavaScript statement is a command that tells a browser to tell what to do. JavaScript statements is a instruction to browser and the statements are executed sequentially.
0 votes
5k views

JavaScript Variable Introduction

Javascript variables is a key to an object of data. Variable is defined using 'var' keyword and JavaScript variables are case sensetive, so 'key' and 'Key' are two different variables.
0 votes
5k views

JavaScript switch statement with number

The switch statement is used to select one statement from the many blocks. This is used on place of nested if…else. If there are number of if..else statements then we should use switch.
1 votes
5k views

JavaScript Arithmetic Operators

Arithmatic operators are used to perform operations on the numbers.
1 votes
4k views

JavaScript Object Introduction

An object is an entity which can have properties, events and methods. This example creates a simple string holding the text 'hello world'. Some Standard Objects that are part of the JavaScript are 'String','Date','Array','Boolean','Array','Math' and 'RegExp'.
0 votes
4k views

JavaScript Comparison Operator ==

JavaScript "==" is equal to operator.
3 votes
4k views

JavaScript if and else

JavaScript if…else is a conditional statement that is used to check wether a condition is true or false to take a decision.
1 votes
4k views

JavaScript For

Javascripts loops are similar to other programming languages. Loops allows us to execute a block of statements to the specified number of times.
1 votes
4k views

JavaScript Try and Catch

Javascript Try…catch statement to check if there is errors in a block of code.
0 votes
4k views

Javascript Guidelines

There are some guidelines which must be remembered while coding in javascript. 1) Javascript is case-sensitive language. 2) JavaScript ignores extra white spaces. 3) You can break the line of code.
0 votes
3k views

HTML5 Drag and Drop between four elements

Drag and Drop magic with HTML5 using an image to drag back and forth between four <div> elements.
0 votes
2k views

jQuery Toggle

The jQuery toggle method toggles the visibility of HTML elements using the show or hide methods. Shown elements are hidden and hidden elements are shown. The speed parameter can take the following values: "slow", "fast", "normal", or milliseconds.
1 votes
1k views

HTML5 Canvas Image

The drawImage method allows you to insert other images (img and canvas elements) into your canvas context. To draw an image using HTML5 Canvas, we can use the drawImage() method which requires an image object and a destination point. The destination point is relative to the top left corner of the image.
1 votes
1k views

jQuery Focus & Change Event

jQuery events can be used to register behaviors to take effect when the user interacts with the browser, and to further manipulate those registered behaviors.
0 votes
1k views

HTML5 Canvas Text

To align HTML5 Canvas text, we can use the textAlign property of the canvas context, which can be set to start, end, left, center, or right. Unless otherwise specified, the textAlign property is defaulted to left.
0 votes
1k views

JavaScript clearInterval method

JavaScript clearInterval function enables you to stop the timer event started by the JavaScript setIntterval function. When you apply the setInterval function a JavaScript function by specifying the time interval then it calls the function continuously after equal intervals of time.
0 votes
1k views

jQuery DOM Traversing and locating elements

Jquery traversing methods can be used to locate all the descendent elements of a particular type of elements.
0 votes
1k views

JavaScript setTimeout method

Here in a text box the timer is display on "start count" button click and stop on "start count " click
1 votes
1k views

Javascript Email Address Validation

JavaScript validation are client side scrips that is used to reduce the server load because all validation are check on client browser. This example validates the input matches a valid e-mail address with a regular expression.
1 votes
1k views

jQuery Selectors Advanced

The jQuery nth-child is used to select all elements that are ntg-child of of their parent. The nth-child(n) is “1-indexed”, meaning the “n” is counting starts at 1. Because jQuery's implementation of :nth-child(n) is strictly derived from the CSS specification, the value of n is "1-indexed", meaning that the counting starts at 1. For all other selector expressions, however, jQuery follows JavaScript's "0-indexed" counting.
1 votes
1k views

HTML5 canvas 2D

HTML5 canvas populated with one filled rectangle and one painted stroke.
2 votes
1k views

jQuery Slide

The jQuery slideUp and slideDown methods gradually change the height of the selected elements.
0 votes
1k views

jQuery Mouse Event

jQuery mouse events are events that have to do with actions of the mouse. These can be a click, double-click, mouse down and more. Mouse events can be used in two different ways.
0 votes
1k views

JavaScript setInterval function

JavaScript setInterval function provides the functionality to execute the specified function after the sepcified time interval in milliseconds. Using the JavaScript setInterval function you can set the time interval to call a function again and again.
0 votes
1k views

jQuery Replace Element

Using jquery manipulation methods, we can replace elements with another elements.
0 votes
1k views

jQuery Fade

The jQuery fade methods gradually change the opacity for selected elements.
1 votes
1k views

jQuery User Controlled Animation

jQuery Animate can function supports animation in different directions
1 votes
1k views

jQuery Browser Detection

jQuery.browser contains flags for the useragent, read from navigator.userAgent. We recommend against using this property; please try to use feature detection instead (see jQuery.support). jQuery.browser may be moved to a plugin in a future release of jQuery.
0 votes
1k views

jQuery Animate

The jQuery animate method has a complete method we can supply with callback function that is fired once the animation is complete. This can be useful for stringing different animations together in sequence like this example.
0 votes
1k views

jQuery Create Element

jQuery provides methods to manipulate documents in efficient way. Using jquery manipulation methods, we can insert element in given document. Like here we add a new element before the blue square.
0 votes
1k views

JQuery Syntax

With jQuery you select (query) HTML elements and perform "actions" on them. The jQuery syntax is tailor made for selecting HTML elements and perform some action on the element(s) or attributes to element(s)
0 votes
1k views

JavaScript switch statement with string

The switch statement is used to select one statement from the many blocks. This is used on place of nested if…else. If there are number of if..else statements then we should use switch.
0 votes
1k views

HTML Noscript

he <noscript> tag is used to provide an alternate content for users that have disabled scripts in their browser or have a browser that doesn’t support client-side scripting. The noscript element can contain all the elements that you can find inside the body element of a normal HTML page. The content inside the noscript element will only be displayed if scripts are not supported, or are disabled in the user’s browser:
0 votes
1k views

jQuery Error handling

Register a handler with jQuery to be called when Ajax requests complete with an error. Whenever an Ajax request completes with an error, jQuery triggers the ajaxError event. Any and all handlers that have been registered with the .ajaxError() method are executed at this time.
0 votes
1k views

JavaScript Logical Operators

JavaScript logical operators are used to determine the logic between variables and values.
1 votes
1k views

jQuery Remove Element

Using jQuery manipulation methods, we can remove elements.
0 votes
1k views

JavaScript onfocus Event

JavaScript event that triggers when object gets focus.
2 votes
1k views

JavaScript screen object

screen object gives your browser screen information like width,height,color depth.
1 votes
1k views

How to use JavaScript

JavaScript can be written at any place in the page or can be in external file. JavaScript is written in the head section in <script> tag.
1 votes
1k views

jQuery Element manipulation

jQuery contains powerful methods (functions) for changing and manipulating HTML elements and attributes. Click on the button to see jQuery hiding the paragraphs.
0 votes
1k views

jQuery - Set CSS for an element

jQuery also allows us the set the property value of the CSS.
0 votes
1k views

jQuery - Multiple CSS properties

jQuery allows to change the multiple CSS properties value at once.
0 votes
1k views

jQuery DOM Traversing and filtering

Most of the JQuery Traversal Methods do not modify the jQuery object and they are used to filter out elements from a document based on given conditions. The filter( selector ) method can be used to filter out all elements from the set of matched elements that do not match the specified selector(s).
0 votes
1k views

JavaScript nested if and else

This statement allows us to select one statement among many statements.It is also called nested if….else.
0 votes
1k views

JavaScript iframe height

The Frame and Iframe represents html frame and iframe respectively.This DOM object has all the properties that a HTML element has. We can change these properties using javascript.
0 votes
1k views

JavaScript Browser Detection

The Navigator object contains information about the visitor's browser.
0 votes
1k views

JavaScript Random

JavaScript random method returns a random number between 0 and 1.
0 votes
1k views

JavaScript Loop with break and continue

Javascript provides us the facility to break a loop in middle and also to continue the loop without executing the whole body of the loop.There are two keywords that provides these facilities: 1) break 2) continue
0 votes
1k views

JavaScript Generating HTML and Text

make your HTML pages become more dynamic and interactive by using JavaScript
0 votes
1k views

JavaScript Submit Event

This event is fired when the form is submitted. This is only works with the form element of the HTML.
1 votes
985 views

jQuery Selectors Types

jQuery selectors allow you to select and manipulate HTML elements as a group or as a single element.
0 votes
982 views

JavaScript Math Object

A javascript Math object allows us to perform the mathematical tasks.
0 votes
977 views

JavaScript Keywords example

A small example displaying the usage of two JavaScript keywords in a code block.
0 votes
962 views

JavaScript Loading Order

The HTML paragraph element is written on the web page before the dynamic content from the script. That is because the script tag is after the paragraph tag. If you move the HTML script element to the "head" tag you will see the dynamic text is written first!
0 votes
957 views

JavaScript Date Object

The Date object is used to work with dates and times.
0 votes
957 views

JavaScript Comparison Operator <

JavaScript < is less then operator.
0 votes
949 views

JavaScript Do While

Do…While loop is the varient of the while loop. The difference between while and do…while is that while loop only executes if the condition is true while do….while loop executes atleast once even the codition is false.
0 votes
941 views

JavaScript function with return value

If you provide a return statement inside a function you may specify the value that you would like to return from the function. So, functions that are going to return a value must use the return statement.
0 votes
929 views

JavaScript RegExp Object

JavaScript regular expression can be used to maniplate strings and perform text searches. In this example we do a case-insensitive search for "www.webgrid.com" in a string.
0 votes
913 views

When JavaScript is not supported

While most current browsers understand Javascript a lot of the early browsers did not. The current browsers also allow Javascript to be turned off and some people do this. What this means is that not all of the visitors to your page will see the effects of the JavaScript on your page. We need to make sure that these visitors can use our site even without JavaScript.
0 votes
910 views

JavaScript Array Object

Javascript array is used to store multiple values in a variable.
0 votes
910 views

JavaScript anonymous setTimeout function

Example how to call anonymous function on setTimeout function.
0 votes
895 views

Delete JavaScript Cookie

Enables you to remove a client cookie with JavaScript. We remove the cookie by setting the expiration date for the cookie back in time.
0 votes
893 views

JavaScript String Object

The String object is used to manipulate texts.
0 votes
876 views

JavaScript DOM setAttribute

We are here using Core DOM setAttribute method we set the value of input type text to button.
0 votes
873 views

JavaScript statement code blocks

JavaScript code are the sequence of statements.These statements can be grouped. These grouped are called blocks and the blocks are created using {} brackets.
0 votes
873 views

JavaScript Boolean Object

The Boolean object is used to convert a non-Boolean value to a Boolean value (true or false).
0 votes
870 views

JavaScript DOM Attribute count

Count number of attributes that exists for the button.
0 votes
869 views

JavaScript variables local and global

If a variable is defined in a function then it will be local for this function, it can not be used outside of that function. A variable which is defined outside of the fuction becomes Global and this variable can be used in whole webpage document.
0 votes
867 views

JavaScript has a flexible variable type

The flexible nature of JavaScript variable types can lead to confusion as to the particular type of a variable at any given time in a script. To address this concern JavaScript provides the typeof operator. The typeof operator returns the current variable type of the specified variable.
0 votes
864 views

JavaScript Comparison Operator !=

JavaScript "==" is not equal to operator.
0 votes
862 views

JavaScript Link Object

The link object is used to include the external file in the web page. This tag must be inside the head tag of the page. Here is the example of the link that give the type of the external sheet.
0 votes
856 views

JavaScript Comparison Operator ===

JavaScript "===" is exactly equal to (value and type) operator.
0 votes
847 views

JavaScript While

As 'for loop' executes the specified number of times, the while loop executes while a condition is true.
0 votes
832 views

Javascript Assignment Operators

Javascript assignment operators are used to assign values.There 6 assignment operators that can be used.
0 votes
830 views

JavaScript Comparision Operators

Comparision Operators are used to compare the values of the variables, and the result is used to make the decision.
0 votes
770 views

JavaScript Comparison Operator >=

JavaScript > is greater or equal to operator.
0 votes
768 views

JavaScript Comparison Operator <=

JavaScript > is less or equal to operator.
0 votes
747 views

JavaScript Comparison Operator >

JavaScript > is greater then operator.
0 votes
727 views

JavaScript Logical Operator || (or)

The || (or operator) logical operator are used to determine the logic between variables or values.
0 votes
724 views

JavaScript Logical Operator ! (not)

The ! (not operator) logical operator are used to determine the logic between variables or values.
0 votes
716 views

JavaScript Logical Operator && (and)

The && (and operator) logical operator are used to determine the logic between variables or values.