Problems with Javascript API

Last post 02-19-2007, 12:14 PM by jbrigham. 2 replies.
Sort Posts: Previous Next
  •  02-19-2007, 10:55 AM 26802

    Problems with Javascript API

    Hi,
     
    I have a very simple little function that is attempting to add some HTML to my editor, but it keeps failing with the typical javascript error ("Object doesn't support this property or method.").
     
    I have looked through this forum, but all the posts regarding Jscript are several years old and I'm not sure if they still apply. The error is occurring on the second line where I do the getHTML() method. In addition, the setHTML() method doesn't work either.
     
    function addItemInfo()
    {
    var editor = document.getElementById('ceEditor');
    var editorContent = editor.getHTML();
    var content = document.all.ddlItemInfo.options[document.all.ddlItemInfo.selectedIndex].value;
    editor.setHTML(content + editorContent);
    }
     
    Please advise.
    Thanks.
    Jason
  •  02-19-2007, 11:48 AM 26804 in reply to 26802

    Re: Problems with Javascript API

    Jason,
     
    You should use the following code to get the cute editor instance

    In order to find the active editor, you'd write: 

    // get the cute editor instance
    var editor1 = document.getElementById('<%= Editor1.ClientID%>');
    Please check the following link for more information:
    http://cutesoft.net/developer+guide/JavaScript-API.htm
     

    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

  •  02-19-2007, 12:14 PM 26805 in reply to 26804

    Re: Problems with Javascript API

    Hi,
     
    Yes.  After some experimenting, it turns out that you place a "CE_" and "_ID" around my actual id.  Therefore when I looked for "CE_ceEditor_ID", it was able to find the object. Now I see what you are pushing using the _ClientID from the server side.
     
    Also, just an FYI, your Javascript API document specifies the setHTML() method as both SetHTML() and setHTML() in a couple places.  The one with the capital "S" looks to be a typo, so I figured I'd let you know.
     
    Thanks.
    Jason
View as RSS news feed in XML