Autor Zpráva
h0n24
Profil
Zdravím,

potřeboval bych zjistit, jak mohu vyrobit textarea, ve kterém by byl určitý text, jenž by byl po kliknutí celý vybrán. Už jsem to na některém webu zahlédl...

Předem děkuji.
MzM
Profil
http://diskuse.jakpsatweb.cz/index.php?action=vthread&topic=44430&foru m=3&page=-1

<textarea cols="30" rows="5" id="area" >
laskdj la kjsdlf asldj flka jsdlfkja lskdfj
</textarea>
<button onclick="vyber_vse('area')" >xXx</button>
<script type="text/javascript">

function vyber_vse(t) {
textarea = document.getElementById(t);
// pro IE a jiné prohlížeče, které podporují "document.selection"
if (document.selection) {
textarea.selection.selectionStart = 0;
textarea.selection.selectionEnd = 10;
textarea.focus();
}

// pro prohlížeče postavené na jádře Gecko
else if (textarea.selectionStart) {
textarea.selectionStart = 0;
textarea.selectionEnd = textarea.value.length-1;
textarea.focus();
}
}
</script>

pro FF to jede pro IE jsem to zatím nenešel,..
h0n24
Profil
Děkuji, přesně to jsem potřeboval...
Toto téma je uzamčeno. Odpověď nelze zaslat.

0