Autor | Zpráva | ||
---|---|---|---|
Jacker Profil * |
#1 · Zasláno: 16. 6. 2007, 11:43:34
Zdravím,
problémová fce: intPozice = null; TEXTAREA function fncInitPos() { if (document.forms[0].dotaz.createTextRange) intPozice = document.selection.createRange().duplicate(); } function add(strText) { if (document.forms[0].dotaz.createTextRange && intPozice != null) { with (intPozice) { text = text.charAt(text.length - 1) == ' ' ? strText + ' ' : strText; } } else document.forms[0].dotaz.value = strText; document.forms[0].dotaz.focus(); } reaguje na textarea s name="dotaz" V IE bez problému ve Fierefoxu vždy pouze vymaže celý textarea a na začátek umístí vkládané slovo. V čem je problém? Co změnit? Díky |
||
Jacker Profil * |
#2 · Zasláno: 16. 6. 2007, 11:44:24
s document.all to taky nešlo ve FF
|
||
Jacker Profil * |
#3 · Zasláno: 16. 6. 2007, 12:24:44
Tady na fóru jsem našel scripta, který mi už funguje. Akorát bych potřeboval napravit detail. Když vložím smaila tak se vloží správně na pozici kurzoru, ale pak kurzor přesune na konec textu.
Script: function add(happy) { smiledone = false; G = document.forms[0].dotaz; if ((navigator.appName=='Microsoft Internet Explorer')&&(!window.opera)) { if((document.selection)&&(G.value.indexOf(document.selection.createRan ge().text)>-1)) { G.focus (); if (!document.selection.createRange().text) { document.selection.createRange().text = ' '+happy+' '; smiledone = true; };};} else { var selLength = G.textLength; var selStart = G.selectionStart; var selEnd = G.selectionEnd; var s1 = (G.value).substring(0,selStart); var s2 = (G.value).substring(selStart, selEnd); var s3 = (G.value).substring(selEnd, selLength); if (s2=='') G.value = s1 + ' '+happy+' ' + s3; if (s2=='') smiledone=true; }; if (!smiledone) G.value += ' '+happy+' '; G.focus(); }; |
||
Časová prodleva: 6 dní
|
|||
peta Profil |
#4 · Zasláno: 22. 6. 2007, 12:42:45
to dela G.focus();
premisti focus do arey, ale problem je v tom, ze on ho dava na konec. Cili toto bys mel smazat. |
||
Časová prodleva: 17 let
|
0