editor de texto html

alfinete

Power Member
tenho este editor de texto em html e javascript

http://rapidshare.com/files/231053969/editor.rar.html

gostave que me dessem um help em relação a ele

pr não funciona em ff

e pq é que mesmo em ie se puser uma caixa de texto por vez do iframe não funcionam as opções
de edição de texto mesmo pondo a caixa de texto com o mesmo id da iframe

tem o link a cima para download

agradecia um help
 
tenho este editor de texto em html e javascript

http://rapidshare.com/files/231053969/editor.rar.html

gostave que me dessem um help em relação a ele

pr não funciona em ff

e pq é que mesmo em ie se puser uma caixa de texto por vez do iframe não funcionam as opções
de edição de texto mesmo pondo a caixa de texto com o mesmo id da iframe

tem o link a cima para download

agradecia um help

Tenta substituir todas as ocorrências de

Código:
editor.document

por

Código:
document.getElementById("editor").contentWindow.document


Por ex:

Código:
editor.document.designMode = 'on';

passa a ser:

Código:
document.getElementById("editor").contentWindow.document.designMode = 'on';

E assim por diante ...
 
obrigada pela ajuda



codigo

Código:
<html>
<head>
<title>Editor de Texto JavaScript ::: Linha de Código</title>
<script language="JavaScript">

    function Iniciar() 
    {
     document.getElementById("editor").contentWindow.document.designMode = "on";
     try {
       document.getElementById("editor").contentWindow.document.execCommand("undo", false, null);
     }  catch (e) {
      
     }
    }
    /*function Iniciar() {
        editor.document.designMode = "On" ;
    }*/

    function recortar() {
        document.getElementById("editor").contentWindow.document.execCommand('cut', false, null);
        try {
       document.getElementById("editor").contentWindow.contentDocument.execCommand("cut", false, null);
        }  catch 
        (e){}
       
        
    }

    function copiar() {
        document.getElementById("editor").contentWindow.document.execCommand('copy', false, null);
        try {
       document.getElementById("editor").contentWindow.contentDocument.execCommand("copy", false, null);
        }  catch 
        (e){}
       
    }
    
    function colar() {
      document.getElementById("editor").contentWindow.document.execCommand('paste', false, null);
        try {
       document.getElementById("editor").contentWindow.contentDocument.execCommand("paste", false, null);
        }  catch 
        (e){}
       
        
    }

    function desfazer() {
    
      document.getElementById("editor").contentWindow.document.execCommand('undo', false, null);
        try {
       document.getElementById("editor").contentWindow.contentDocument.execCommand("undo", false, null);
        }  catch 
        (e){}
        
    }

    function refazer() {
      document.getElementById("editor").contentWindow.document.execCommand('redo', false, null);
        try {
       document.getElementById("editor").contentWindow.contentDocument.execCommand("redo", false, null);
        }  catch 
        (e){}
        
    }

    function negrito() {
    
      document.getElementById("editor").contentWindow.document.execCommand('bold', false, null);
        try {
       document.getElementById("editor").contentWindow.contentDocument.execCommand("bold", false, null);
        }  catch 
        (e){}
        
    }

    function italico() {
        document.getElementById("editor").contentWindow.document.execCommand('italic', false, null);
        try {
       document.getElementById("editor").contentWindow.contentDocument.execCommand("italic", false, null);
     }  catch (e) {
       
     }
    }

    function sublinhado() {
        document.getElementById("editor").contentWindow.document.execCommand('underline', false, null);
        try {
       document.getElementById("editor").contentWindow.contentDocument.execCommand("underline", false, null);
     }  catch (e) {
       
     }
        
    }

    function alinharEsquerda() {
        document.getElementById("editor").contentWindow.document.execCommand('justifyleft', false, null);
        try {
       document.getElementById("editor").contentWindow.contentDocument.execCommand("justifyleft", false, null);
     }  catch (e) {
       
     }
        
    }

    function centralizado()    {
    
            document.getElementById("editor").contentWindow.document.execCommand('justifycenter', false, null);
        try {
       document.getElementById("editor").contentWindow.contentDocument.execCommand("justifycenter", false, null);
     }  catch (e) {
       
     }
        
    }

    function alinharDireita() {
    
            document.getElementById("editor").contentWindow.document.execCommand('justifyright', false, null);
        try {
       document.getElementById("editor").contentWindow.contentDocument.execCommand("justifyright", false, null);
     }  catch (e) {
       
     }
    
    
    }

    function numeracao() {
    
        document.getElementById("editor").contentWindow.document.execCommand('insertorderedlist', false, null);
        try {
       document.getElementById("editor").contentWindow.contentDocument.execCommand("insertorderedlist", false, null);
     }  catch (e) {
       
     }
    
    }

    function marcadores() {
    
    document.getElementById("editor").contentWindow.document.execCommand('insertunorderedlist', false, null);
        try {
       document.getElementById("editor").contentWindow.contentDocument.execCommand("insertunorderedlist", false, null);
     }  catch (e) {
       
     }
    
        
    }

    function fonte(fonte) {
    
        if(fonte != '')
        {
            document.getElementById("editor").contentWindow.document.execCommand('fontname', false, fonte);
                try {
               document.getElementById("editor").contentWindow.contentDocument.execCommand("fontname", false, fonte);
             }  catch (e) {
               
             }
        }
        
    }

    function tamanho(tamanho) {
        
        if(tamanho != '')
        {
            document.getElementById("editor").contentWindow.document.execCommand("fontsize", false, tamanho);
            try
                {
                
                document.getElementById("editor").contentWindow.contentDocument.execCommand("fontsize", false, tamanho);
                       
                }  
                 catch (e) {
                   
                 }
        }
        
    
           
        
         
        
    }
    


</script>

<body onLoad="Iniciar()" bgcolor="#EFEDE1">
<table align="center" width="600px" height="30px" border="0" cellspacing="0" cellpadding="0" >    
    <tr>
    <td align="center">

    <select name="fonte" onChange="fonte(this.options[this.selectedIndex].value)">
        <option value=""></option>
        <option value="Arial">Arial</option>
        <option value="Courier">Courier</option>
        <option value="Sans Serif">Sans Serif</option>
        <option value="Tahoma">Tahoma</option>
        <option value="Times New Roman">Times New Roman</option>
        <option value="Verdana">Verdana</option>
    </select>
    &nbsp;        
    <select name="tamanho" onChange="tamanho(this.options[this.selectedIndex].value)">
        <option value=""></option>
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6">6</option>
    </select>

    </td>

    <td align="center">
        
        <!-- Recortar -->
        <img alt="Cortar" src="recortar.gif" onClick="recortar()" style="cursor:hand">
            
        <!-- Copiar -->
        <img alt="Copiar" src="copiar.gif" onClick="copiar()" style="cursor:hand">
            
        <!-- Colar -->
        <img src="colar.gif" onClick="colar()" style="cursor:hand">
            
        <!-- Desfazer --> 
        <img src="desfazer.gif" onClick="desfazer()" style="cursor:hand">
            
        <!-- Refazer -->
        <img src="refazer.gif" onClick="refazer()" style="cursor:hand">
            
        <!-- Negrito --> 
        <img src="negrito.gif" onClick="negrito()" style="cursor:hand">
            
        <!-- Itálico -->
        <img src="italico.gif" onClick="italico()" style="cursor:hand">
            
        <!-- Sublinhado -->
        <img src="sublinhado.gif" onClick="sublinhado()" style="cursor:hand">
            
        <!-- Alinhar à Esquerda -->
        <img src="alinhamentoesquerda.gif" onClick="alinharEsquerda();" style="cursor:hand">
            
        <!-- Alinhar ao Centro -->
        <img src="centralizado.gif" onClick="centralizado()" style="cursor:hand">
            
        <!-- Alinha à Direita -->
        <img src="alinhamentodireita.gif" onClick="alinharDireita()" style="cursor:hand">
            
        <!-- Numeração -->
        <img src="numeracao.gif" onClick="numeracao()" style="cursor:hand">

        <!-- Marcadores -->
        <img src="marcador.gif" onClick="marcadores()" style="cursor:hand">
    
    </td>
    </tr>
    </table>

    <center>
    
            <iframe id="editor" frameborder="2" 
        style="border:1px solid; width: 582px; height:350px"></iframe>

        
    <br><br>
    
    <font size="-1">
        Editor de Texto JavaScript <br>
        
    </font>
    </center>

</body>
</html>


so que a funcionalidade copy não funciona não sei pq

alguem poderá ajudar
 
Back
Topo