Google
 

Archive for September, 2007

function.apply() and function.call() in JavaScript

Function object methods function.apply() and function.call() basically do the same job, that is to invoke the function as if it was the method of a specified object so that the ‘this’ keyword within the function is treated as that object rather than the global object.
var x = 20;

DOM event detection: event bubbling and event capturing

There’s essentially 2 ways for the DOM to detect any events, namely event capturing and event bubbling.
Event capturing is a method that the browser captures the event from the top elements to the bottom where the event actually takes place. For example, the moment you click on an <img> which is the child of a [...]

Make elements translucent with CSS - the bulletproof solution

Take a div of class translucent for example, you can literally make it translucent with the following CSS rules. It’s bulletproof, meaning that all the browsers will render it as you have specified. Enjoy!
div.translucent { /* this class makes a window partially transparent */
    opacity: .5;               /* Standard style for transparency */
    -moz-opacity: .5;          /* Transparency [...]

Stop it from bothering the user with error warnings in JavaScript

Use the following line to keep the browser or console from warning the user of your program errors.
window.onerror = function( ) { return true; }
That’s it!

Portable functions for manipulating browser window

This petite JavaScript snippet defines several functions in the namespace of Geometry that will come handy when you need to manipulate window geometry, freeing you from the depressing chores of distinguishing different browsers for their distinct implementations of virtually the same features.
/**
 * This module defines functions for querying window and document geometry.
 *
 * Geometry.getWindowX/Y( ): return the [...]

Page 1 of 1:1