I have this script which you can demo it here: http://www.freewebs.com/moreauctions/one.html Instead of having an input and button for each textarea, I want to have just one input box and a drop menu to choose which of the two textareas to add the text to. Like this: http://www.freewebs.com/moreauctions/two.html I have played with onChange but I couldn't get it to work.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Interactive Textarea</title> <script type="text/javascript"> function settext(area) { var form = document.forms[0]; var text = form.inputtext1.value; if (text && area == 'ad1' || area == 'ad2') { document.getElementById(area).value += '· ' + text + '\n'; } } function rem(obj) { var txt = document.getElementById(obj).value; if (!txt) return; var n = txt.lastIndexOf('·'); document.getElementById(obj).value = txt.substr(0,n); } </script> </head> <body> <form> <table style="text-align: left; width: 100px;" border="0" cellpadding="0" cellspacing="2"> <tbody> <tr> <td colSpan="2"><input size="30" name="inputtext1" id="inputtext1" value=""> Add to... <select onchange="settext(this.value);" name="area" id="area"> <option selected="selected">-------</option> <option value="ad1">Textarea One</option> <option value="ad2">Textarea Two</option> </select> </td> </tr> <tr> <td>Textarea One<br><textarea rows="7" id="ad1" name="ad1" cols="22" readonly style="overflow: auto;"></textarea><div style="text-align: right;"><input name="remove" id="remove" value="Remove" onclick="rem('textarea1')" type="button"></div> </td><td>Textarea Two<br><textarea rows="7" id="ad2" name="ad2" cols="22" readonly style="overflow: auto;"></textarea><div style="text-align: right;"><input name="remove" id="remove" value="Remove" onclick="rem('textarea2')" type="button"></div></td> </tr> </tbody> </table> </form> <br> <!-- --><script type="text/javascript" src="/i.js"></script><script type="text/javascript">if(typeof(urchinTracker)=='function'){_uacct="UA-230305-2";_udn="freewebs.com";urchinTracker();}</script></body> </html> HTML: