Page 1 of 1

Javascript Code

Posted: Mon 27 Feb 2012 5:01 pm
by liamcarbin
Fairly new to website development etc so I need a bit of help please.

Basically what im trying to do is place an arrow next to temperaturetrendtext tag

Ive tried with this script but getting nowhere.

<script type="text/javascript">
var #temptrendtext = ;
if (temptrendtext=steady){var image = "steady.bmp";}
if (temptrendtext=rising){var image = "up.bmp";}
if (temptrendtext=falling){var image = "down.bmp";}
document.write('<img src="http://www.abbeyhultonweather.com/images/'+image+'"/>');
</script>

Thanks

Re: Javascript Code

Posted: Mon 27 Feb 2012 5:14 pm
by steve
You don't need to use javascript at all. If you give your images the same names as the temperature trend values, ie. steady.bmp, rising.bmp, and falling.bmp, then a simple bit of html will do:

<img src="http://www.abbeyhultonweather.com/image ... dtext>.bmp"/>

Re: Javascript Code

Posted: Mon 27 Feb 2012 5:45 pm
by liamcarbin
Thanks Steve, I have applied the same to forecast by changing <temptrendtext> to <forecast> works a treat :D