Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Formatowanie textu z poziomu strony
Pudi
post
Post #1





Grupa: Zarejestrowani
Postów: 76
Pomógł: 0
Dołączył: 3.03.2009
Skąd: WLKP

Ostrzeżenie: (10%)
X----


(IMG:http://img141.imageshack.us/img141/628/beztytuuhjo.jpg) <---- Jak zrobić żeby mi wyświetlało nad polem do edycji o nazwie np. pole2 takie zeczy i po kliknięciu dodawało do pola textarea (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (żeby działało to na Mozilli i na IE) tak jak na forum plz o pomoc (IMG:http://forum.php.pl/style_emoticons/default/blinksmiley.gif)

Ten post edytował Pudi 8.05.2009, 20:45:37
Go to the top of the page
+Quote Post
phpion
post
Post #2





Grupa: Moderatorzy
Postów: 6 072
Pomógł: 861
Dołączył: 10.12.2003
Skąd: Dąbrowa Górnicza




FCKeditor lub TinyMCE
Go to the top of the page
+Quote Post
Pudi
post
Post #3





Grupa: Zarejestrowani
Postów: 76
Pomógł: 0
Dołączył: 3.03.2009
Skąd: WLKP

Ostrzeżenie: (10%)
X----


Cytat(phpion @ 8.05.2009, 21:46:49 ) *


Ale mi chodzi zeby miec tylko 1 a nie wszystko ja tylko 1 potrzebuje może da ktoś kodzik??
Go to the top of the page
+Quote Post
kefirek
post
Post #4





Grupa: Zarejestrowani
Postów: 781
Pomógł: 256
Dołączył: 29.06.2008

Ostrzeżenie: (0%)
-----


  1. <script language='JavaScript'>
  2. function addText(elname, wrap1, wrap2) {
  3. if (document.selection) { // for IE
  4. var str = document.selection.createRange().text;
  5. document.forms['inputform'].elements[elname].focus();
  6. var sel = document.selection.createRange();
  7. sel.text = wrap1 + str + wrap2;
  8. return;
  9. } else if ((typeof document.forms['inputform'].elements[elname].selectionStart) != 'undefined') { // for Mozilla
  10. var txtarea = document.forms['inputform'].elements[elname];
  11. var selLength = txtarea.textLength;
  12. var selStart = txtarea.selectionStart;
  13. var selEnd = txtarea.selectionEnd;
  14. var oldScrollTop = txtarea.scrollTop;
  15. //if (selEnd == 1 || selEnd == 2)
  16. //selEnd = selLength;
  17. var s1 = (txtarea.value).substring(0,selStart);
  18. var s2 = (txtarea.value).substring(selStart, selEnd)
  19. var s3 = (txtarea.value).substring(selEnd, selLength);
  20. txtarea.value = s1 + wrap1 + s2 + wrap2 + s3;
  21. txtarea.selectionStart = s1.length;
  22. txtarea.selectionEnd = s1.length + s2.length + wrap1.length + wrap2.length;
  23. txtarea.scrollTop = oldScrollTop;
  24. txtarea.focus();
  25. return;
  26. } else {
  27. insertText(elname, wrap1 + wrap2);
  28. }
  29. }
  30. </head>
  31. <form name='inputform' method='post'>
  32. <textarea name='body' cols='20' rows='5' class='textbox'></textarea>
  33. <input type='button' value='b' class='button' onClick='addText("body", "", "");'>
  34. </form>
  35. </body>
  36. </html>


Powinno dzialac reszte dorób sobie sam dodając
  1. <input type='button' value='b' class='button' onClick='addText("body", "", "");'>


Ten post edytował kefirek 9.05.2009, 08:16:17
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 11.10.2025 - 15:26