如何在 CKEditor 中键入时显示警告消息?在 ASP.NET Web 应用程序中使用 javascript/c#

How to display alert message while typing inside CKEditor? Using javascript/c# in an ASP.NET Web application

<div>
    <CKEditor:CKEditorControl ID="CKEditor1" BasePath="~/ckeditor/" runat="server" Width="1108px" Height="383px"></CKEditor:CKEditorControl>
</div>
<script  type = "text/javascript">
             $(document).ready(function () {
                 CKEDITOR.on('instanceCreated', function (e) {
                     e.editor.on('contentDom', function () {
                         e.editor.document.on('keydown', function (event) {

                                 if (event.data.$.keyCode == 97) {
                                    alert('Key Pressed');
                                 }                           

                             });                     

                     });
                 });

             });

    </script>

上面的代码我试过但没有用。如果有人知道请分享。 如何在 CKEditor 中键入时显示警告消息?在 ASP.NET Web 应用程序中使用 javascript/c#。

您的问题是选择的事件。使用 key 而不是 keydownHere 是一个有效的 fiddle 示例。

CKEDITOR.instances.yourtextareaid.on('key', function (event) {
                                //press a to see this working
                                 if (event.data.keyCode == 65) {
                                    alert('Key Pressed');
                                 }                           
                             });