On 2/23/06, Louis Walch <[EMAIL PROTECTED]> wrote: > whoops, sorry > > <script language="javascript"> > function displayPreviewIcon(){ > inputs = getInputsByAttribute('fldtype','filelocation'); > for(i=0; i < inputs.length; i++){ > //Testing > inputs[i].style.backgroundColor = '#ff00ff'; > } > } > </script> > > which is called onLoad
When you call a function, that function is executed (by default) in the global context. In client-side development, the global context is the 'window' object, not the 'document' object. Either redefine your function as window.getInputsByAttribute (or, don't use an object qualifier at all; it'll default to 'window') or call it as document.getInputsByAttribute, which is where you're defining it. When you access 'document', it's really giving you 'window.document', so your function is really 'window.document.getInputsByAttribute'. There's an extra layer you're not accounting for. Todd _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs