HTMLTextAreaElement.prototype.wordSelect = function()
{
if(this.selectionStart !== this.selectionEnd){
this.focus();
return; //sai da função e não retorna nada
}
var startCursor = this.selectionStart;
var endCursor = this.selectionEnd;
var txt = this.value;
while (startCursor >= 0 && txt.charAt(startCursor -1) != ' ' && txt.charAt(startCursor) != '\n' && !txt.charAt(startCursor -1).isPoint())
startCursor--;
while (endCursor <= txt.length && txt.charAt(endCursor) != ' ' && txt.charAt(endCursor) != '\n' && !txt.charAt(endCursor).isPoint())
endCursor++;
//alert(startCursor);
this.selectionStart = startCursor;
this.selectionEnd = endCursor;
this.focus();
};
- Fórum WMO
- → Viewing Profile: Posts: Rafael P L
Community Stats
- Group Usuários
- Active Posts 9
- Profile Views 1417
- Member Title Novato no fórum
- Age 38 years old
- Birthday April 29, 1987
-
Sexo
Male
-
Localidade
Campos dos Goytacazes - RJ
0
Neutral
User Tools
Friends
Rafael P L hasn't added any friends yet.
Latest Visitors
No latest visitors to show
Posts I've Made
In Topic: Problema Com Loop
15/08/2011, 17:31
Meu camarada, deu certo. Qualquer coisa, se eu precisar de algo a mais eu posto. Segue o código funcionando como pensado inicialmente.
In Topic: Problema Com Loop
15/08/2011, 15:30
Huahuahuahua. Estou chorando aqui de rir. Gostei do "pelo amor de Deus". Vou testar.
Funcionou garotin. Se é baum mermo eim!!!
Funcionou garotin. Se é baum mermo eim!!!
In Topic: Problema Com Loop
15/08/2011, 14:44
Mas aí é que está Henderson, por que para a direita, funciona perfeitamente, isto é, na etapa do endCursor?
In Topic: Problema Com Loop
15/08/2011, 14:33
Dá para anexar arquivos aqui no fórum?
In Topic: Problema Com Loop
15/08/2011, 13:58
Mas eu já estou fazendo isso, decrementando o startCursor, repare o interior do primeiro while.
- Fórum WMO
- → Viewing Profile: Posts: Rafael P L
- Privacy Policy
- Regras ·



Postagens