Skip navigation

Category Archives: javascript

i was trying to bring prototype into a non-prototype page and this error happened:

element is null

on page load.


How come its not loading?

Well it turns out I’m so in love with prototype that I had already defined:

function $(a)
  return document.getElementById( a ) ;

as you recognize as a commonly used prototype convenience function. once that function decl is deleted, prototype now integrates beautifully into my already javascript-caked page.



ie 8 passes Acid 2.

Wow! I remember seeing Hakon Wium talk about how badly ie fails in this youtube video (he starts speaking at about the 28 minute mark)

also today: iui lib – apple-iphone like interface – very cool

asserts in C++

And some nerdcore rap that entertains (however briefly), linked to in above article: mcplusplus

If you’re going to hardcode event handlers right into your HTML, (perhaps its being delivered from a php page) there’s 2 ways you can do this:

<span onclick=” runFuncAndTargetIsTHIS( this ); “> <!– way A –>


<span onclick=” runFuncButNeedToExtractTarget( event ); “> <!– way B –>

Function for way A looks like:

runFuncAndTargetIsTHIS( elem )
    alert( elem + ' is the HTML element that was clicked' );

While way B:

runFuncButNeedToExtractTarget( e )
    e = e || window.event;
    var target = || e.srcElement;
    alert( target + ' is the HTML element that was clicked' );

Some people say you shouldn’t do things using Way A. But I find Way A sometimes convenient. The only reason I can think of right now that Way A is bad is its easier to cancel propagation (cancel bubbling) of event registered using way B.

this entry explains how to use window.setTimeout( code, delay );

the first argument can be a function object

i didn’t write a single line of javascript yesterday. i actually felt guilty.