Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Editor > Microsoft Jscript runtime error:'OnClientLoad' undefined

Not answered Microsoft Jscript runtime error:'OnClientLoad' undefined

Feed from this thread
  • NVB avatar

    Posted on Jan 31, 2012 (permalink)

    I am getting runtime error  " Microsoft JScript runtime error: 'ONClientLoad' is undefined

    I have radeditor defined with  clientside event

     <telerik:RadEditor ID="RadEditor3" Runat="server" EditModes="Design, Preview"

     StripFormattingOnPaste="MSWordNoFonts" Width="100%" OnClientLoad="OnClientLoad"

     AutoResizeHeight="false" BorderStyle="None" Height="530px" Skin="Office2007" >


    Javascript function is

    function OnClientLoad(editor) {
               editor.attachEventHandler("onkeydown", function(e) {
                   var content = editor.get_text(); //returns the editor's content as plain text
                   var words = 0;
                   if (content) {
                       var punctRegX = /[!\.?;,:&_\-\-\{\}\[\]\(\)~#'"]/g;
                       var contentcontent = content.replace(punctRegX, "");
                       var trimRegX = /(^\s+)|(\s+$)/g;
                       contentcontent = content.replace(trimRegX, "");
                       if (content) {
                           splitRegX = /\s+/;
                           var array = content.split(splitRegX);
                           words = array.length;
                       }
                   }
                   // var counter = $get("counter");
                   // counter.innerHTML = "Words: " + words + " Characters: " + content.length;
                   var wcountLabel = document.getElementById("<%= lblWordCount.ClientID %>";
                   var hfwcountId = document.getElementById("<%= hfWordCount.ClientID %>");
                   wcountLabel.innerText = "Words: " + words;
                   hfwcountId.innerText = words 
               });

    Please let me know what I am missing here

    Thanks

    Reply

  • Posted on Feb 1, 2012 (permalink)

    Hello,

    I have tried to reproduce the same but no avail. When I examined your code, I found that the function is not closed properly.
    JS:
    <script type="text/javascript">
      function OnClientLoad(editor, args)
      {
        editor.attachEventHandler("onkeydown", function(e)
          {
            //your code
          });
      }
    </script>

    Thanks,
    Princy.

    Reply

  • NVB avatar

    Posted on Feb 1, 2012 (permalink)

    Thanks Princy.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Editor > Microsoft Jscript runtime error:'OnClientLoad' undefined
Related resources for "Microsoft Jscript runtime error:'OnClientLoad' undefined"

ASP.NET Editor Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]