View Single Post
ישן 28-08-06, 17:03   # 1
RS324
תודה על תרומתך.
 
מיני פרופיל
תאריך הצטרפות: May 2006
הודעות: 3,173

RS324 לא מחובר  

preg_replace עושה את העבודה הרבה יותר מהר והרבה יותר מקצועי
אבל כרצונך

לגבי הכפתור :

ב HEAD תשים את זה
PHP קוד:
<script type="text/javascript">
    function 
addtoForm(openTagcloseTagtextAreaId){ /// Add tags code to textarea
    
           
var txtAr document.getElementById(""+textAreaId), oRange
        txtAr
.focus()
        if (
document.selection && document.selection.createRange){
            
oRange=document.selection.createRange(); /// Create Range object form the selected Text
            
if (oRange.parentElement()==txtAr){ /// Check if the parent of the Range object is our textarea
             
oRange.textopenTag+oRange.text+closeTag /// add the tags before and after the selected text
            
}
        }else if(
navigator.appName=="Netscape"){
            var 
txtLength parseInt(txtAr.textLength// fint the length of the selected text
            
var selStart=txtAr.selectionStart /// find the start position
            
var selEnd=txtAr.selectionEnd /// find the end position
            
if (selEnd==|| selEnd==1){
                
selEnd=txtLength
            
}
            var 
sect1 = (txtAr.value).substring(0,selStart/// text before the selected text
            
var sect2 = (txtAr.value).substring(selStart,selEnd// the selected text
            
var sect3 = (txtAr.value).substring(selEnd,txtLength/// text after the selected text
            
txtAr.value sect1+openTag+sect2+closeTag+sect3 /// add the tags before and after the selected text
            
txtAr.focus()
        }
    }

</script> 
בכפתור תשים את זה :

[
PHP]
onclick=\"addtoForm('[p*h*p]','[/p*h*p]','formidhere')

[/PHP]
  Reply With Quote