Mam jakiś tekst w texarea.
Zaznaczam jego fragmenti i wciskam button.
Zaznaczony fragment textu zostaje zamieniony na DUŻE ZNAKI
Jak tego dokonać?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <script language="JavaScript"> /* konwersja na małe i duże znaki napis = napis.toLowerCasePL(); */ String.prototype.toUpperCasePL = function(){ this.replace(/ą/g,"Ą"); this.replace(/ć/g,"Ć"); this.replace(/ę/g,"Ę"); this.replace(/ł/g,"Ł"); this.replace(/ń/g,"Ń"); this.replace(/ó/g,"Ó"); this.replace(/ś/g,"Ś"); this.replace(/ź/g,"Ź"); this.replace(/ż/g,"Ż"); return this.toUpperCase(); } String.prototype.toLowerCasePL = function(){ this.replace(/Ą/g,"ą"); this.replace(/Ć/g,"ć"); this.replace(/Ę/g,"ę"); this.replace(/Ł/g,"ł"); this.replace(/Ń/g,"ń"); this.replace(/Ó/g,"ó"); this.replace(/Ś/g,"ś"); this.replace(/Ź/g,"ź"); this.replace(/Ż/g,"ż"); return this.toLowerCase(); } function zamien(atype) { editFrame.focus(); var selectedRegion = editFrame.document.selection.createRange(); if(atype == "lower") selectedRegion.text = selectedRegion.text.toLowerCasePL(); else if(atype == "upper") selectedRegion.text = selectedRegion.text.toUpperCasePL(); } </script> <input type="submit" name="UpperCase" id="UpperCase" value="UPPER" onclick="zamien('upper')" title="UpperCase" /> <input type="submit" name="LowerCase" id="LowerCase" value="lower" onclick="zamien('lower')" title="LowerCase" /> <br /> </body> </html>