Re: Wrong <SCRIPT/> tag formatting

  •  11-21-2011, 6:07 AM

    Re: Wrong <SCRIPT/> tag formatting

    Hi Herev,
     
    If you set it as the code below, that should be the correct behavior. Because your content in the same line, so editor set it as the same line.
     
    function setContent()
    {
        var editor1=document.getElementById("<%= editor1.ClientID %>");
        var s="<script>alert('111');// simply a test function</"+"script>";
        editor1.SetHTML(s);
    }
     
    Try the example below, it shows you how to use the line break to avoid it.
     
    <%@ 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>
            <input type="button" value="Set html" onclick="setContent()" />
        </form>
    </body>
    </html>

    <script>
    function setContent()
    {
        var editor1=document.getElementById("<%= editor1.ClientID %>");
        var s="<script>alert('111');"+"//simply a test function\n</"+"script>";
        editor1.SetHTML(s);
           
    }
    </script>
     
    Regards,
     
    Ken
View Complete Thread