| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| DNOA Member | Hey, I've found some samples online but none of them work... or at least in Firefox. My form is named "form1" and my textbox is named "tarea". Can anybody find some code that WORKS on BOTH browsers? (IE and FF). Kudos, I mean, 15 NP$ to you if it works properly ![]() Cheers, -Matt
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
| | #2 (permalink) |
| NPQ's PA, Slave, and On Call Coder Technical Services | I found this, I've not tried it though. http://www.codingforums.com/archive/...p/t-44679.html HTML Code: <script type="text/javascript"> function setCaret (textObj){ if (textObj.createTextRange){ textObj.caretPos = document.selection.createRange().duplicate(); } } function insertAtCaret (textObj, textFeildValue){ if(document.all){ if (textObj.createTextRange && textObj.caretPos){ var caretPos = textObj.caretPos; caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?textFeildValue + ' ' : textFeildValue; }else{ textObj.value = textFeildValue; } }else{ if(textObj.setSelectionRange){ var rangeStart = textObj.selectionStart; var rangeEnd = textObj.selectionEnd; var tempStr1 = textObj.value.substring(0,rangeStart); var tempStr2 = textObj.value.substring(rangeEnd); textObj.value = tempStr1 + textFeildValue + tempStr2; }else{ alert("This version of Mozilla based browser does not support setSelectionRange"); } } } </script> <form id="form1" action="" onsubmit="" method="post" enctype="text/plain"> <p> <textarea name="tarea" rows="" cols="" style="width:300px;height:120px;" onselect="setCaret(this);" onclick="setCaret(this);" onkeyup="setCaret(this);" > Click in this textObj anywhere and then press the button below. It will insert the text at the caret position.</textarea> <br/><br/> <input type="text" name="textfield" style="width:220px;" value="Mozilla 1.4"/> <br/> <input type="button" value="insert at caret" onclick="insertAtCaret(this.form.tarea,this.form.textfield.value);"/> </p> </form>
__________________ |
| |
| | #3 (permalink) |
| DNOA Member | Yeah that's one that didn't work -_-
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Join DropWatch.com pay using NP$ | Domainut | For Sale / Advertising Board | 9 | 08-03-2005 03:39 PM |
| Cheap Names With Prices in $ and NP$ | DomainOgre | Domains For Sale - Fixed Price | 5 | 11-29-2003 01:10 PM |