McMahon has asked for the wisdom of the Perl Monks concerning the following question:
<html> <head> <title>Test form</title> <script type="text/JavaScript"> <!-- function storeCaret (textEl){ if (textEl.createTextRange){ textEl.caretPos = document.selection.createRange().duplicate +(); } } function insertAtCaret (textEl, text){ if (textEl.createTextRange && textEl.caretPos) { var caretPos = textEl.caretPos; caretPos.text = caretPos.text.charAt(caretPos.text.length - +1) == ' ' ? text + ' ' : text; }else{ textEl.value += text; } } function addItem(label){ //document.display.showStuff.value += "%"+label+"%"; insertAtCaret(document.display.showStuff,label); } --> </script> </head> <body> <h1>Test Form</h1> <form name="display" method="post" action=""> <input type="button" value="test1" onclick="javascript:addItem(' +TEST')"> <input type="button" value="test2" onclick="javascript:addItem(' +ABCD')"> <input type="button" value="test3" onclick="javascript:addItem(' +RGFD')"> <input type="button" value="test4" onclick="javascript:addItem(' +HGFD')"> <br> <textarea name="showStuff" rows="5" cols="80" wrap="off" onselec +t="storeCaret(this);" ond blclick="storeCaret(this);" onclick="storeCaret(this);" onkeyup="store +Caret(this)"></textarea> </form> </body> </html>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Further question: automating Javascript with Perl in browser?
by diotalevi (Canon) on Jun 11, 2004 at 16:05 UTC | |
|
Re: Further question: automating Javascript with Perl in browser?
by Fletch (Bishop) on Jun 11, 2004 at 16:02 UTC | |
|
Re: Further question: automating Javascript with Perl in browser?
by PodMaster (Abbot) on Jun 11, 2004 at 18:32 UTC | |
by McMahon (Chaplain) on Jun 11, 2004 at 18:51 UTC | |
|
Re: Further question: automating Javascript with Perl in browser?
by dba (Monk) on Jun 12, 2004 at 13:52 UTC |