Re: <body> value can be change

  •  04-09-2009, 10:25 AM

    Re: <body> value can be change

    Hi goh6613,
     
    Try this way:
     
    Need to go to HTML view
     

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

    <%@ Register Namespace="CuteEditor" Assembly="CuteEditor" TagPrefix="CE" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <script runat="server">

    </script>

    <script>
    function changeBodyStyle()
    {
        var editor1 = document.getElementById('<%= Editor1.ClientID%>');
        var content = editor1.GetHTML();
        var cleanContent=content.replace(/(<body[^\>]*\>)/i, "<body style='background-repeat: no-repeat' background='http://localhost:2341/eTemplate_develop/member/template/xyz.jpg' border='1'> ");
        editor1.SetHTML(cleanContent)
    }

    </script>

    <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" EditCompleteDocument="true">
                </CE:Editor>
                <input id="Button1" type="button" value="button" onclick="changeBodyStyle()" />
            </div>
        </form>
    </body>
    </html>

     
     
    Regards,
     
    Ken
View Complete Thread