<html> <head> <title>javaScriptTest</title> <script> function insertAtCursor(myField, myValue_i) { // Source of this function. // http://alexking.org/blog/2003/06/02/inserting-at-the-cursor-using-javascript //IE support myValue = myValue_i.value; if (document.selection) { myField.focus(); sel = document.selection.createRange(); sel.text = myValue; } //MOZILLA/NETSCAPE support else if (myField.selectionStart || myField.selectionStart == '0') { var startPos = myField.selectionStart; var endPos = myField.selectionEnd; myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length); } else { myField.value += myValue + '3'; } myValue_i.value = '#'; } </script> </head> <body> <select size=1 onchange="insertAtCursor(document.getElementById('text_felt'), this)"> <option value="#" class="tekst"> dk </option> <option value="æ" class="u"> [æ] </option> <option value="Æ" class="u"> [Æ] </option> <option value="ø" class="u"> [ø] </option> <option value="Ø" class="u"> [Ø] </option> <option value="å" class="u"> [å] </option> <option value="Å" class="u"> [Å] </option> <option value="©" class="u"> [©] </option> <option value="®" class="u"> [®] </option> <option value="ª" class="u"> [ª] </option> <option value="Ψ" class="u"> [Ψ] </option> <option value=" " class="u">space</option> </select> <hr> <textarea class="textarea" cols="50" rows="6" name="text_felt" id="text_felt"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ligula risus, semper quis rhoncus vitae, dapibus sed lorem. </textarea> </body> </html>