Re: Wrong <SCRIPT/> tag formatting

  •  11-22-2011, 7:22 AM

    Re: Wrong <SCRIPT/> tag formatting

    Hi Herev,
     
    I tried save the content into the  HiddenField control, it still works fine for me.
     
    Below is my test example
    <%@ Page Language="C#" AutoEventWireup="true" %>

    <%@ 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 id="Head1" runat="server">
    </head>
    <body>
        <form id="form1" runat="server">
            <CE:Editor ID="editor1" runat="server" EditCompleteDocument="true" EnableStripScriptTags="false">
            </CE:Editor>
            <asp:HiddenField ID="hf1" runat="server" />
            <input type="button" value="get html" onclick="getContent()" />
            <input type="button" value="Set html" onclick="setContent()" />
        </form>
    </body>
    </html>

    <script>
       var hf1=document.getElementById("<%= hf1.ClientID %>");
    function setContent()
    {
      var editor1=document.getElementById("<%= editor1.ClientID %>");
       editor1.SetHTML("");
       editor1.SetHTML(hf1.value);
          
    }
    function getContent()
    {
       var editor1=document.getElementById("<%= editor1.ClientID %>");
       hf1.value=editor1.getHTML();
     
    }
    </script>
     
     
    Test steps
     
    1. Run the page then paste the code below into html view
     
    <script>
    alert('111');//simply a test function
    </script>
     
    2.  Click the get content button, then the html code will save into the HiddenField
     
    3.  Click the  set content button. editor will clean the old text then set the HiddenField value which get from the getHTML() API into editor again.
     
    I thought that should be same as the content save into the database right?
     
    Regards,
     
    Ken
     
View Complete Thread