Should DOM elements be defined to a variable?
<p>For example in this object function I put the elements in a variable called Text array.  I then access the variable as needed.  However I could have just accessed the form directly as needed with out the variable.  Which way is best practice?  Also I could have used documentGetElementbyId as a third way.  I've also seen access to the DOM using just dot notaion with out the [].  That is 4 all together.  What is the best way to do it?  If it is case specefic..then what is the best way to do it for the object function below.</p>

<pre><code>var Text = function( form_name ) 
{
    this.text_array = document.forms[form_name].elements;
};

Text.prototype.patterns = 
{
    prefix_url:     /^http:\/\//,
    url:            /^.{1,2048}$/,
    tweet:          /^.{1,40}$/, 
    title:          /^.{1,32}$/, 
    name:           /^.{1,64}$/, 
    email:          /^.{1,64}@.{1,255}$/,
    pass:           /^.{6,20}$/
};

Text.prototype.checkPattern = function( type ) 
{
    return this.patterns[type].exec( this.text_array[type].value );
};

Text.prototype.checkUrlAdd = function( type ) 
{
    return this.patterns[type].exec( this.text_array.url.value );
};  

Text.prototype.checkSameEmail = function() 
{
    return ( (this.text_array.email.value) === (this.text_array.email1.value) );
};

Text.prototype.checkEmpty = function() 
{
    var element;
    for ( element in this.text_array )
    {
        if( this.text_array[element].value === '' ) 
        {
            return 0;
        }
    }
    return 1;
};
</code></pre>
