Jshint.com suggests this for the code below:
Line 150: }, false );
Don't make functions within a loop.
But, it allows me to not have to write document.getElementById() multiple times, instead I can save the ids in an array and loop through them.
More concise and maintainable code I feel.
function styleTwitter( pair_array )
{
var i, input, label;
for ( i = 0; i < pair_array.length; i+=2 )
{
input = document.getElementById( pair_array[ i ] );
label = document.getElementById( pair_array[ i + 1 ] );
input.addEventListener( "focus", function()
{
if( input.value === '' )
{
label.style.opacity = 0;
input.style.border = '1px solid #888888';
}
}, false );
input.addEventListener( "blur", function()
{
if( input.value === '' )
{
label.style.opacity = 1;
new EffectsFont( label ).fade( 'up', 150 );
input.style.border = '1px solid #dddddd';
}
}, false );
}