Google
 

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;

Read the rest of this entry »

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 <p> which is further spawned from a <div>, the document element namely <body> captures the event first before it gets down the path to the eventual source of the event, that is the <img>.

Read the rest of this entry »

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 for older Mozillas */
    filter: alpha(opacity=50);  /* Transparency for IE */
}

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 position of the window on the screen
 * Geometry.getViewportWidth/Height( ): return the size of the browser viewport area
 * Geometry.getDocumentWidth/Height( ): return the size of the document
 * Geometry.getHorizontalScroll( ): return the position of the horizontal scrollbar
 * Geometry.getVerticalScroll( ): return the position of the vertical scrollbar
 *
 * Note that there is no portable way to query the overall size of the
 * browser window, so there are no getWindowWidth/Height( ) functions.
 *
 * IMPORTANT: This module must be included in the <body> of a document
 *            instead of the <head> of the document.
 */

Read the rest of this entry »

wordpress theme magmania refined to 1.01

It’s downloadable from here. Amuse yourself with the screenshot presented below.

magmania wordpress theme screenshot

Find the perfect page to build links on

Site-wide linking merely passes any more credit to the linked pages than single page linking. Linking from the homepage of a site isn’t always that sweetest after all. So what we got? The answer is to find the perfect pages to build links on.

There’re essentially 2 sorts of pages we’d love to have links to ours. Read the rest of this entry »

Stop diluting the page theme, but siloing

Link(v.), only when it’s absolutely necessary, especially on your premier pages (landing pages from search engines) that have a touching relation with the sales. Every offsite link you make on the page, and even onsite links to other pages, dilutes the theme you intend to rank for in search engines, thus effectively bringing down the performance of targeted terms.

When you have to link, however, make sure that the linked page is as relevant as possible with the linking page. While doing a deep optimization of certain pages, reducing the number of irrelevant links on those pages as many as possible is definitely a good idea. Therefore, you should deflate the site navigation as well as other unnecessary link spots as thin as possible and construct vertical linking structures for each targeted theme while maintaining a site-wide theme that’s more general in niche.

Read the rest of this entry »

Page 3 of 6:«123456»