problem to set background image using <body>

Last post 04-09-2009, 10:26 AM by Kenneth. 6 replies.
Sort Posts: Previous Next
  •  04-07-2009, 11:45 PM 50864

    problem to set background image using <body>

    hi all
     
    i use <body background='abc.jpg'></body> to set my background image in cute editor,
     
    but when i try to get html code using getHTML (javascript) but it seem like igone everything inside the <body>....
     
    but when i try to insert cute editor content into database using editor1.text, the <body> is included,
     
    may i know what happen ? or anyone can suggest me a better way to set my backgraound image ...
     
    thanks
     
  •  04-07-2009, 11:50 PM 50865 in reply to 50864

    Re: problem to set background image using <body>

    goh6613,
     
    Please check this property:
     

    Editor.EditCompleteDocument Property

    Specify whether a complete HTML document is being edited.

    Remarks
    If false, the editor will only process content inside the page body i.e. all content inside of the <body>...</body> tags of a page. If true, the editor will process content outside the page body and preserve header tags (e.g. <head>...</head>, <title>...</title>, etc.).
     
    Demo:
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  04-08-2009, 1:19 AM 50869 in reply to 50865

    Re: problem to set background image using <body>

    thanks,
     
    this helped me in solving my problem...
  •  04-08-2009, 8:41 PM 50898 in reply to 50869

    Re: problem to set background image using <body>

    hi,
     
    may i know that how can i change the content in cuteeditor using javascript,
     
    for example :
     
    my current cuteeditor's html code is
     
    <html>
        <head>
        </head>
        <body style="background-repeat: no-repeat" background=http://localhost:2341/eTemplate_develop/member/template/abc.jpg" border="1">
        </body>
    </html>
     
    but when the use click on a button, i call a javascript to change the background image to this
     
    <html>
        <head>
        </head>
        <body style="background-repeat: no-repeat" background=http://localhost:2341/eTemplate_develop/member/template/xyz.jpg" border="1">
        </body>
    </html>
     
    i tried to use javascript string replace method, but it did not work
     
    may i know what other solution i can apply to solve this problem ?
     
    thanks
  •  04-09-2009, 1:34 AM 50907 in reply to 50898

    Re: problem to set background image using <body>

    hi
     
    i found that using setHTML only able to change content value only, but right now i wanna change the background image, how can it set it, this is my code
     
    <html>
        <head>
        </head>
        <body style="background-repeat: no-repeat" background=http://localhost:2341/eTemplate_develop/member/template/abc.jpg" border="1">
        </body>
    </html>
     
    how can i set my background image using <img> which the image's position is fixed and always at the last layer
     
    thanks
  •  04-09-2009, 3:26 AM 50911 in reply to 50898

    Re: problem to set background image using <body>

    hi
     
    is it possible for me to call a javascript function to change the background which i set in <body> in a cuteeditor....
     
    this is my javascript function :
     

    function fnChangeTemplate(TemplateID,Orientation,CategoryID,FileName,BackGround,Side)

    {

    if(Side=='front')

    {

    var editor1 = document.getElementById('<% = ceFrontDesign.ClientID %>');

    var str=editor1.getHTML();

    var sNewTemplate=BackGround.replace(/bbbbb/g,"/");

    editor1.setHTML(str.replace(document.getElementById("txtTemplateFront_Background").value,sNewTemplate));

    document.getElementById("txtTemplateID_Front").value=TemplateID;

    document.getElementById("txtOrientation_Front").value=Orientation;

    document.getElementById("txtCategoryID_Front").value=CategoryID;

    document.getElementById("lblTemplateName_Front").innerHTML="Current Template : " + FileName;

    document.getElementById("txtTemplateFront_Background").value=sNewTemplate;

    }

    else

    {

    var editor1 = document.getElementById('<% = ceBackDesign.ClientID %>');

    var str=editor1.getHTML();

    var sNewTemplate=BackGround.replace(/bbbbb/g,"/");

    editor1.setHTML(str.replace(document.getElementById("txtTemplateBack_Background").value,sNewTemplate));

    document.getElementById("txtTemplateID_Back").value=TemplateID;

    document.getElementById("txtOrientation_Back").value=Orientation;

    document.getElementById("txtCategoryID_Back").value=CategoryID;

    document.getElementById("lblTemplateName_Back").innerHTML="Current Template : " + FileName;

    document.getElementById("txtTemplateBack_Background").value=sNewTemplate;

    }

    }

     
    but it cannot work !!!
     
    any idea to solve this problem ?
     
    thanks
  •  04-09-2009, 10:26 AM 50932 in reply to 50911

    Re: problem to set background image using <body>

    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 as RSS news feed in XML