Re: How to extract plain HTML instead of formatted?

  •  11-05-2008, 12:04 AM

    Re: How to extract plain HTML instead of formatted?

    Hi sanjay,
     
     
    Try this example:
     

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

    <%@ Register Assembly="CuteEditor" Namespace="CuteEditor" TagPrefix="CE" %>
    <!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">
            <div>
                <CE:Editor ID="Editor1" runat="server">
                </CE:Editor>
             Input some text and click the button<br />
                <asp:Button ID="b1" runat="server" OnClientClick="noSpace();return false"  Text="NoSpace"/>
        <asp:Button ID="b2" runat="server" OnClientClick="haveSpace();return false" Text=HaveSpace /><br />
           <asp:Label ID="Label1" runat="server" ></asp:Label>
            </div>
        </form>
    </body>
    </html>

    <script>
    function noSpace ()
    {
    var editor1 = document.getElementById('<% = Editor1.ClientID%>');
    var content = editor1.GetDocument().body.innerHTML;
    var label1=document.getElementById('<% = Label1.ClientID%>');
    label1.innerText=content;
    }
    function haveSpace ()
    {
    var editor1 = document.getElementById('<% = Editor1.ClientID%>');
    var content = editor1.GetHTML();
    var label1=document.getElementById('<% = Label1.ClientID%>');
    label1.innerText=content;
    }
    </script>

     

     
    Regards,
     
    Ken
View Complete Thread