2009
Jul
05

The W3C standard API for determining the computed style of an element is the getComputedStyle() method of the Window object. The first argument to this method is the element whose computed style is desired. The second argument is any CSS pseudoelement, such as ":before" or ":after" whose style is desired. In the Mozilla and Firefox implementation of this method, the second argument is required and may not be omitted. As a result, you'll usually see getComputedStyle() invoked with null as its second argument.

2009
Jun
17

To make sure that any elements that may effect the content's height are loaded, I normally attach the function to the window.onload event. The document containing the iframe can obtain references to properties and elements in the iframed document through contentDocument or contentWindow properties. The contentDocument property has broad support among current browsers, including Internet Explorer 8+, Firefox, Chrome, Safari and Opera. The contentWindow property is supported by Internet Explorer 5.5+, Firefox, Chrome, Safari and Opera.

2009
Jun
15

A number that specifies which mouse button changed state during a mousedown, mouseup, or click event. A value of 0 indicates the left button, 1 indicates the middle button, and 2 indicates the right button. Specify the X and Y coordinates of the mouse pointer, relative to the upper-left corner of the browser's viewport and do not take document scrolling into account.

2009
Jun
04

Syntax errors are errors in grammar and punctuation such as mismatched quotes or missed commas. These errors are caught quickly if you have the browser's built-in error detector in display mode or run the script through jsLint. Runtime errors only show up as the script is executed. Common examples are calling a function that hasn't been declared (typing error or case-sensitivity issue) or division by zero. Although JavaScript is typeless, many built in objects expect and/or return specific types (eg. style.left needs string type).

2009
May
26

Cookies are small amounts of data 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. Cookies are typically used by web servers to perform functions such as tracking your visits to websites, enabling you to log in to sites, and storing your shopping cart.

2009
Apr
26

Netscape maintained that the event on element1 takes place first. This is called event capturing. The event handler of element1 fires first, the event handler of element2 fires last. W3C has very sensibly decided to take a middle position in this struggle. Any event taking place in the W3C event model is first captured until it reaches the target element and then bubbles up again.

2009
Apr
21

Dynamic Style LoadingExamplevar HTTPUTILITY = { getStyle: function(url, callback) { var isLoaded = false; var style = document.createElem...

2009
Apr
20

Here we set up two different event handlers on the newly created script tag. Depending on the browser, one or the other of these two handlers is supposed to be called when the script has finished loading. The onreadystatechange handler works on IE only. The onload handler works on Gecko browsers and Opera.

2009
Mar
23

Private variables are declared with the var keyword inside the object, and can only be accessed by private functions and privileged methods.