accessing the editor's text in javascript (ASP version!)

Last post 09-19-2007, 3:36 PM by Adam. 5 replies.
Sort Posts: Previous Next
  •  01-27-2005, 4:25 AM 3752

    accessing the editor's text in javascript (ASP version!)

    What a great piece of software!
     
    I have a question that's been asked several times in this forum, but I didn't understand the responses, so I'll try to be more specific:
     
    1. I've created a custom button:
     
    editor.CustomAddons = "<img title=""Custom Addons"" class=""button"" onclick=""sendText()"" ...
     
    2. As you can see, this button calls a javascript function named sendText()
     
    What I need to do is grab the editor's text in that javascript function, but I don't understand how to reference it. Here's what I DO know:

    I've pretty much just copied the sample "simple.asp", so...
    - the page contains a form named "theForm"
    - the form contains a table with ID="Table1"
    - that table contains another table with ID="Table2"
    - that table contains a td with ID=ContentPane
    - this td contains the editor
    - as far as I know, the editor doesn't have a "name", but editor.ID = "Editor1"

    So, can you tell me exactly what my javascript function should look like? I've tried this, but to no avail:

    function sendText() {
     var editor=document.getElementById("Editor1");
     alert(editor.text);
    }

    Many thanks in advance, and thanks again for such a great product!

    Cheers,
    Matt Stuehler



     
     
  •  01-27-2005, 4:36 AM 3753 in reply to 3752

    Re: accessing the editor's text in javascript (ASP version!)

    My apologies!
     
    After a more thorough search, I found exactly the answer I needed in a post from Adam:

    function getHTML() {
     
     //Editor1 is the ID of the Editor
     var editor = document.getElementById("Editor1_editBox");
     alert(editor.innerHTML);

    }

    I didn't know about that "_editBox" part!

    Thanks Adam!
     
     
  •  03-22-2007, 1:37 PM 27634 in reply to 3753

    Re: accessing the editor's text in javascript (ASP version!)

    This doesn't seem to work anymore in v5.3. Has something changed?
  •  03-22-2007, 2:01 PM 27636 in reply to 27634

    Re: accessing the editor's text in javascript (ASP version!)

  •  09-19-2007, 4:54 AM 33620 in reply to 3753

    Re: accessing the editor's text in javascript (ASP version!)

    pffft - that doesn't work - you should TRY the code first, or at least come back here and comment that it doesn't work - I sure wish that the documentation was up to snuff.
  •  09-19-2007, 3:36 PM 33644 in reply to 33620

    Re: accessing the editor's text in javascript (ASP version!)

    mobasoft:
    pffft - that doesn't work - you should TRY the code first, or at least come back here and comment that it doesn't work - I sure wish that the documentation was up to snuff.
     
    If you are using version 6.0 you should use the following JavaScript API:
     
     
    Getting the CuteEditor Instance

    In order to find the active editor, you would type: 

    // get the cute editor instance
    var editor1 = document.getElementById('CE_Editor1_ID');

    Getting the Active Editor Window

    In order to find the active editor window, you would type: 

    // get the active editor window
    var editwin = editor1.GetWindow();

    Getting the Active Editor Document


    In order to find the active editor document, you would type:

    // get the active editor document

    var editdoc = editor1.GetDocument();

     

    Getting the Active Editor Selection


    In order to find the active editor selection, you would type:

    // get the active editor selection

    var sel = editor1.GetSelection();

    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

View as RSS news feed in XML