Witam mam taki problem. Mam skrypt:
<?php
var clientInfo = navigator.userAgent.toLowerCase();
var isIE = ( clientInfo.indexOf("msie") != -1 );
var isWin = ( (clientInfo.indexOf("win")!=-1) || (clientInfo.indexOf("16bit") != -1) );
function createBBtag( openerTag , closerTag , areaId ) {
if(isIE && isWin) {
createBBtag_IE( openerTag , closerTag , areaId );
}
else {
createBBtag_nav( openerTag , closerTag , areaId );
}
return;
}
function createBBtag_IE( openerTag , closerTag , areaId ) {
var txtArea = document.getElementById( areaId );
var aSelection = document.selection.createRange().text;
var range = txtArea
.createTextRange
(); if(aSelection) {
document.selection.createRange().text = openerTag + aSelection + closerTag;
txtArea.focus();
}else {
var oldStringLength
= range.text
.length
+ openerTag
.length
; txtArea.value += openerTag + closerTag;
txtArea.focus();
range.move
('character',oldStringLength
); }
return;
}
function createBBtag_nav( openerTag , closerTag , areaId ) {
var txtArea = document.getElementById( areaId );
if (txtArea.selectionEnd && (txtArea.selectionEnd - txtArea.selectionStart > 0) ) {
var preString = (txtArea.value).substring(0,txtArea.selectionStart);
var newString = openerTag + (txtArea.value).substring(txtArea.selectionStart,txtArea.selectionEnd) + closerTag;
var postString = (txtArea.value).substring(txtArea.selectionEnd);
txtArea.value = preString + newString + postString;
txtArea.focus();
}else{
var offset = txtArea.selectionStart;
var preString = (txtArea.value).substring(0,offset);
var newString = openerTag + closerTag;
var postString = (txtArea.value).substring(offset);
txtArea.value = preString + newString + postString;
txtArea.selectionStart = offset + openerTag.length;
txtArea.selectionEnd = offset + openerTag.length;
txtArea.focus();
}
return;
}
function url(areaId){
var address=prompt("Wpisz adres:", "http://");
if(address!=null && address!=""){
var description=prompt("Treść odnośnika:","");
var area=document.getElementById(areaId);
if(description==null || description==""){
area
.value
+=""+address
+""; }else{
area
.value
+=""+description
+""; };
}else{
alert("Nie wpisaleś adresu odnośnika ");
};
};
function img(areaId){
var address=prompt("Wpisz adres do zdjęcia:","http://");
if(address!=null && address!=""){
var description=prompt("Opis zdjęcia:","");
var area=document.getElementById(areaId);
if(description==null || description==""){
area.value+="[IMG="+address+"]"+address+"[/IMG]";
}else{
area.value+="[IMG="+address+"]"+description+"[/IMG]";
};
}else{
alert("Nie wpisaleś adresu do zdjęcia ");
};
};
?>
i taki formularz:
<form method="post" action="skrypt.php"> <option value="6" onclick="java script:createBBtag('','','content');">4pt
</option> <option value="7" onclick="java script:createBBtag('','','content');">4pt
</option> <option value="8" onclick="java script:createBBtag('','','content');">4pt
</option> <option value="9" onclick="java script:createBBtag('','','content');">4pt
</option> <option value="10" onclick="java script:createBBtag('','','content');">4pt
</option> <option value="11" onclick="java script:createBBtag('','','content');">4pt
</option>
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

. Prosze o pomoc
Ten post edytował piotrekkr 14.06.2006, 16:25:38