Witam mam taki problem. Mam skrypt:
  1. <?php
  2. var clientInfo = navigator.userAgent.toLowerCase();
  3. var isIE = ( clientInfo.indexOf("msie") != -);
  4. var isWin = ( (clientInfo.indexOf("win")!=-1) || (clientInfo.indexOf("16bit") != -1) );
  5.  
  6. function createBBtag( openerTag , closerTag , areaId ) {
  7. if(isIE && isWin) {
  8. createBBtag_IE( openerTag , closerTag , areaId );
  9. }
  10. else {
  11. createBBtag_nav( openerTag , closerTag , areaId );
  12. }
  13. return;
  14. }
  15.  
  16. function createBBtag_IE( openerTag , closerTag , areaId ) {
  17. var txtArea = document.getElementById( areaId );
  18. var aSelection = document.selection.createRange().text;
  19. var range = txtArea.createTextRange();
  20. if(aSelection) {
  21. document.selection.createRange().text = openerTag + aSelection + closerTag;
  22. txtArea.focus();
  23. range.move('textedit');
  24. range.select();
  25. }else {
  26. var oldStringLength = range.text.length + openerTag.length;
  27. txtArea.value += openerTag + closerTag;
  28. txtArea.focus();
  29. range.move('character',oldStringLength);
  30. range.collapse(false);
  31. range.select();
  32. }
  33. return;
  34. }
  35.  
  36. function createBBtag_nav( openerTag , closerTag , areaId ) {
  37. var txtArea = document.getElementById( areaId );
  38. if (txtArea.selectionEnd && (txtArea.selectionEnd - txtArea.selectionStart > 0) ) {
  39. var preString = (txtArea.value).substring(0,txtArea.selectionStart);
  40. var newString = openerTag + (txtArea.value).substring(txtArea.selectionStart,txtArea.selectionEnd) + closerTag;
  41. var postString = (txtArea.value).substring(txtArea.selectionEnd);
  42. txtArea.value = preString + newString + postString;
  43. txtArea.focus();
  44. }else{
  45. var offset = txtArea.selectionStart;
  46. var preString = (txtArea.value).substring(0,offset);
  47. var newString = openerTag + closerTag;
  48. var postString = (txtArea.value).substring(offset);
  49. txtArea.value = preString + newString + postString;
  50. txtArea.selectionStart = offset + openerTag.length;
  51. txtArea.selectionEnd = offset + openerTag.length;
  52. txtArea.focus();
  53. }
  54. return;
  55. }
  56.  
  57. function url(areaId){
  58. var address=prompt("Wpisz adres:", "http://");
  59. if(address!=null && address!=""){
  60. var description=prompt("Tre¶æ odno¶nika:","");
  61. var area=document.getElementById(areaId);
  62. if(description==null || description==""){
  63. area.value+=""+address+"";
  64. }else{
  65. area.value+=""+description+"";
  66. };
  67. }else{
  68. alert("Nie wpisale¶ adresu odno¶nika ");
  69. };
  70. };
  71.  
  72. function img(areaId){
  73. var address=prompt("Wpisz adres do zdjêcia:","http://");
  74. if(address!=null && address!=""){
  75. var description=prompt("Opis zdjêcia:","");
  76. var area=document.getElementById(areaId);
  77. if(description==null || description==""){
  78. area.value+="[IMG="+address+"]"+address+"[/IMG]";
  79. }else{
  80. area.value+="[IMG="+address+"]"+description+"[/IMG]";
  81. };
  82. }else{
  83. alert("Nie wpisale¶ adresu do zdjêcia ");
  84. };
  85. };
  86. ?>


i taki formularz:
  1. <form method="post" action="skrypt.php">
  2. <div>
  3. <option value="0" >Czcionka</option>
  4. <option value="6" onclick="java script:createBBtag('','','content');">4pt</option>
  5. <option value="7" onclick="java script:createBBtag('','','content');">4pt</option>
  6. <option value="8" onclick="java script:createBBtag('','','content');">4pt</option>
  7. <option value="9" onclick="java script:createBBtag('','','content');">4pt</option>
  8. <option value="10" onclick="java script:createBBtag('','','content');">4pt</option>
  9. <option value="11" onclick="java script:createBBtag('','','content');">4pt</option>
  10. </div>
  11. <div>
  12. <textarea id="content">
  13. </div>
  14. </form>


teraz tak zmiana czcionki dziala w Operze i w firefoxie a nie dziala w IE i safari znaczy po wybraniu czcionki nic sie nie dzieje. Same skrypty do obejmowania tagiem zaznaczonego tekstu dzialaja tylko nie dzialaja jakby zdarzenia wyboru z listy. Prosilbym o wyjasnienie dlaczego to nie dziala w tej dziadowskiej przegladarce IE i jak zrobic zeby dzialalo. Aha i druga sprawa nie bardzo wiem jak zrobic zeby w miejscu kursora wstawial sie np jakis tekst to znaczy wiedzialbym jak to zrobic zeby dzialao w operze i firefoxie ale nie wiem jak w IE bo ona jakis swoj wlasny javascript angrysmiley.gif . Prosze o pomoc