• javascript inheritance

            Javascript has not class, it has only function. So its inheritance is somewhat confusing. Before we talk about inheritance, let's make sure we understanding the basic. Here is the fact.
            <ol>
            <li>a function has property "prototype", the prototype object's points back to the function itself.
            <img src="http://msdn.microsoft.com/msdnmag/issues/07/05/JavaScript/fig03.gif" />
    
  • page event beforeunload vs unload

            <p>beforeunload happend before unload. beforeunload can give user a message, asking user if want to contine or not, if yes, unload event will trigger and unload can show user a message, but can not block to unload the page. Below is the sample.</p>
    
  • Animation

            <h4>Slide In</h4>
            <p>A Function for Slowly Revealing a Hidden Element by Increasing Its Height Over a
            Matter of One Second.</p>
    
  • Javascript and Postion

            <p>
            In CSS, elements are positioned using
            offsets. The measurement used is the amount of offset from the top-left corner of an element’s parent.
            </p>
    
  • Finding the actual computed value of a CSS Style Property on an Element

            <pre data-sub="prettyprint:_">
            // Get a style property (name) of a specific element (elem)
            function getStyle( elem, name )
            {
            // If the property exists in style[], then it's been set
            // recently (and is current)
            if (elem.style[name])
            {
            return elem.style[name];
            }
            // Otherwise, try to use IE's method
            else if (elem.currentStyle)
            {
            return elem.currentStyle[name];
            }
            // Or the W3C's method, if it exists
            else if (document.defaultView && document.defaultView.getComputedStyle)
            {
            // It uses the traditional 'text-align' style of rule writing,
            // instead of textAlign
            name = name.replace(/([A-Z])/g,"-$1");
            name = name.toLowerCase();
            // Get the style object and get the value of the property (if it exists)
            var s = document.defaultView.getComputedStyle(elem,"");
            return s && s.getPropertyValue(name);
            // Otherwise, we're using some other browser
            } else
            return null;
            }
            </pre>