I'm trying to create a function that take sin three variables, ID, attribute, and value. The ID is the ID of the object, the attribute is the style attribute of said object that I wish to manipulate, and the value is the new value to change the attribute to. Seems simple enough...

I've got it all so that it evaluates everything except it fail to find the object to apply.

function stylize(id,attr,val){
var atr="document.getElementById("+id+").style."+attr+"="+"\""+val+"\"";
HTML looks like this:

<input type="text" name="query" size="30" value='' onclick="stylize('query','color','#000000')" id="query">
I get the following error:
'query' is undefined

Any thoughts?