How to use JavaScript math.round in an HTML IMG tag?
<p>Background: I have a simple web page displaying current weather conditions from a backyard weather station. I am trying to add a UV image on the web site. I'm comfortable with basic HTML, but JavaScript seems like a foreign language to me. I've found threads about using <code>Math.round</code>, and calling images in JavaScript, but haven't figured out how to combine the two.</p>

<p>My weather software outputs the UV Index with a one-place decimal point. I want to round to an integer, and then use that integer to place an image relevant to that integer on the web page.</p>

<p>I've figured out how to get <code>Math.round</code> to replace the template's UV callout with an integer. The software's template tag for UV is <code>STAT$UV:CURRENT$</code>. When I put this in a JavaScript (with text before and after to give the entire image file name) it looks like this:</p>

<pre><code>UV_&lt;script type="text/javascript"&gt;document.write(Math.round(STAT$UV:CURRENT$));&lt;/script&gt;.gif
</code></pre>

<p>This results in <code>UV_X.gif</code> being displayed on my web page, as expected, where X equals the current UV Index. But when I try to wrap this in an IMG tag I can't get the results I'm after.</p>

<p>I think I need to use a variable, but I don't understand variables and the syntax needed to call out the image.</p>

<p>Any suggestions?</p>

<p><strong>[EDIT]</strong></p>

<p>I tested the three suggestions in the answers below. None resulted in displaying the image, so I've probably not explained my question well enough.</p>

<p>The weather software runs locally on my computer. It receives a packet of data from the outdoor weather station, processes that data, and displays it on screen. It also populates a locally stored template and then uploads it to my web site via FTP. Other than a couple pre-packages scripts on the server, everything is processed locally. My test page for these suggestions is at avon-weather.com/test.html Take a peek and see if you see what I'm doing wrong? Thanks! </p>
