logo

New Response

« Return to the blog entry

You are replying to:

    • avatar
    • Brian Miller
    • Posted on Thu 1 Mar 2007 12:22 PM

    @Michael:

    Careful, now - not every element defaults to display: inline. Setting the display to a null string uses the browser default for the type of element. This is especially thorny when you're dealing with table parts.

    @Jake:

    One best-practice you might want to start getting into is avoiding cluttering the global (window) namespace. Every time you do a

    function blap (foo) { alert( "Your code here." ) };

    you're actually attaching that function to the window object. Better might be something like this:

    var Codestore = {

    toggle: function(foo,bar) { ... },

    waffle: function(baz) { ... },

    baffle: function(bling) { ... }

    };

    You would call this by using Codestore.toggle("b0rp", true);

    Besides slightly better memory performance, you also get a little bit of organization. And, you don't have to worry about some other programmer hogging the global name "toggle" on you.

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: