« From mass media to personal media | Main | The new askx.com beta site »

Mysterious JavaScript function call failure and loading optimization

Optimize Your Scripts in DHTML Using the DEFER Attribute

When, for example, a perfect JavaScript function call foo() with the correct syntax is always mysteriously ignored, watch out for the side effect of script loading optimization. The root cause turned out to be that the script that contains the foo() function is loaded like the the following with "defer":

<script src="foo.js" type="text/javascript" defer> </script>

//foo.js
function foo() {
    document.write("hello");
}

Optimization never comes for free. Watch out for the side effects it may brings.

TrackBack

TrackBack URL for this entry:
http://stanblog.jojoyao.com/cgi-bin/mt/mt-tb.cgi/5

Post a comment


About

This page contains a single entry from the blog posted on January 21, 2007 11:57 AM.

The previous post in this blog was From mass media to personal media.

The next post in this blog is The new askx.com beta site.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.33