change image width with javascript
<p>I'm new to javascript, and i have a qouestion about the setAttributes of an image.
I want to change the width of an image depending on it's currently width. It must look something like this i think:</p>

<pre><code>var curWidth=this.im.width;
if(curWidth&gt;300)
   curWidth=300;
this.im.setAttributes
({
    src : this.inputs['src'].value,
    className: this.inputs['class'].value,
    width:curWidth
});
</code></pre>

<p>Like this it dosen't work. What's the proper way to do this?</p>
