function zibEditor() { var prevKey = ''; } zibEditor.prototype.init = function() { var editorInstance = dojo.widget.byId("dojoEditor"); dojo.event.connect(editorInstance, "onchange", "xeditor.handlekeypress"); dojo.event.connect(editorInstance, "onkeypress", "xeditor.handlekeypress"); } zibEditor.prototype.handlekeypress = function(evt){ alert('in handleKeyPress'); evt = (evt) ? evt : (window.event) ? event : null; if (evt) { var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0)); if (charCode == 13) { if(this.prevKey == 13) { document.getElementById('menuList').style.display='inline'; this.prevKey = ''; } else { document.getElementById('menuList').style.display='none'; this.prevKey = charCode; } } else { document.getElementById('menuList').style.display='none'; this.prevKey = charCode; } } }