The code below writes whatever text value is presented in each text number, with an onlclick command. The problem I cant figure out is, it replaces text, all text, where as I really wanted it just to write not replace. For example a text file might be written as: hello world Code (markup): I wanted to be able to write: hello world {$ad1} Code (markup): But "hello world" gets removed and replaced with {$ad1} Could some explain why maybe or supply a solution or alternative method? <script type="text/javascript"> function textval(textnumber){ text = new Array() text[1] = "{$ad1}" text[2] = "{$ad2}" text[3] = "{$ad3}" text[4] = "{$ad4}" text[5] = "{$ad5}" document.form1.template.value=text[textnumber] } </script> <a href = "#" onclick="textval(1);">Advert 1</a> <a href = "#" onclick="textval(2);">Advert 2</a> <a href = "#" onclick="textval(3);">Advert 3</a> <a href = "#" onclick="textval(4);">Advert 4</a> <a href = "#" onclick="textval(5);">Advert 5</a> <br> <form name="form1"> <textarea name="textarea2"> </textarea> </form> PHP: