Javascipt attachevent lost on postback

  •  05-24-2007, 5:42 AM

    Javascipt attachevent lost on postback

    I'm currently evaluating CuteEditor and have a snag with js events and postbacks.
     
    In essence, when the page intitially loads, I can attach events fine, it works. However, once the page has been posted back, the events are not attached (unless the text in the cute editor has changed).
     
    From what I can gather, the CuteEditor_OnInitialized event is not firing when the text has not been changed on postback.
     
    Any ideas?

    function check(evt, editorId)
    {
     alert('keypressed');
     return true;
    }

    function InitializeEditor(editorId)
    {
     var editor1 = document.getElementById(editorId);
     var editdoc = editor1.GetDocument();
     editdoc.attachEvent('onkeypress',function x(){return check(event, editorId);} );
    }

    function CuteEditor_OnInitialized(e)
    {
       InitializeEditor(e.id);
    }

    Scott

View Complete Thread