Re: How do I clear the text using javascript?

  •  05-25-2009, 10:51 PM

    Re: How do I clear the text using javascript?

    Hi esack,
     
    If you want to hide editor when page load, please do not use 'display:none', try the code below, it will not get the error.
     
    ---------------------------------------------------------------------------------->

    <%@ Page Language="C#" %>

    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <input type="button" id="button1" onclick="set()" value="SetHtml" />
            <input type="button" id="button2" onclick="show()" value="ShowEditor" />
            <div id="div1" style="visibility: hidden">
                <CE:Editor ID="editor1" runat="server">
                </CE:Editor>
            </div>
        </form>
    </body>
    </html>

    <script>
    function set()
    {
    var editor1=document.getElementById("<%= editor1.ClientID %>");
    editor1.SetHTML(" ");
    //if SetHTML("") can not clean the text, tyr add a space, like SetHTML(" ")
    }
    function show()
    {
    var div1=document.getElementById("div1");
    div1.style.visibility="visible"
    }
    </script>
     ---------------------------------------------------------------------------------->
     
    Regards,
     
    Ken
View Complete Thread