壹次网首页 | 工具源码首页 | 技术文章首页 | 文章分类 | | |

文章搜索: 分类 关键字
您的位置:首页网络编程JavaScript → 论坛常用js,IE7不支持Ctrl+Enter回贴的解决办法
论坛常用js,IE7不支持Ctrl+Enter回贴的解决办法
添加日期:2006-11-23 9:17:28     [ ]

前些日子有人发现IE7对Ctrl+Enter不支持。
分析了一下,原来是IE7去掉了对原来Javascript中ctrlKey、shiftKey、和altKey的支持。
没办法只好换成原来的键值了。

说说IE7的这个修正,
其实ctrlKey、shiftKey、和altKey本身也是对键值的判断,只不过是集成在JS里面了。
这样开发者也不用多记代码了,执行起来也不用多转个弯子了。

以动网的DVBBS7修改作范例,具体自己对比研究:

DhtmlEdit.js
line 37
 IframeID.document.write ('  if(event.ctrlKey && window.event.keyCode==13&&ispost==0)');
-------------------------------------------------------------------------
 IframeID.document.write ('  if(event.keyCode==17 && window.event.keyCode==13&&ispost==0)');
line 78
  if(event.ctrlKey && event.keyCode==13)
-------------------------------------------------------------------------
  if(event.keyCode==17 && event.keyCode==13)
post.js
line 22
        if(event.ctrlKey && window.event.keyCode==13){i++;if (i>1) {alert('帖子正在发出,请耐心等待!');return false;}this.document.form.submit();}
-------------------------------------------------------------------------
        if(event.keyCode==17 && window.event.keyCode==13){i++;if (i>1) {alert('帖子正在发出,请耐心等待!');return false;}this.document.form.submit();}
reply.js
line 36
 editor.document.write ('  if(event.ctrlKey && window.event.keyCode==13&&ispost==0)');
-------------------------------------------------------------------------
 editor.document.write ('  if(event.keyCode==17 && window.event.keyCode==13&&ispost==0)');
line 396
  if(event.ctrlKey && event.keyCode==13&&ispost==0)
-------------------------------------------------------------------------
  if(event.keyCode==17 && event.keyCode==13&&ispost==0)
fckeditorcode_gecko_1.js
line 25
FCK.Description="FCKeditor for Gecko Browsers";FCK.InitializeBehaviors=function(){var oOnContextMenu=function(e){e.preventDefault();FCK.ShowContextMenu(e.clientX,e.clientY);};this.EditorDocument.addEventListener('contextmenu',oOnContextMenu,true);var oOnKeyDown=function(e){if (e.ctrlKey&&!e.shiftKey&&!e.altKey){if (e.which==86||e.which==118){if (FCK.Status==FCK_STATUS_COMPLETE){if (!FCK.Events.FireEvent("OnPaste")) e.preventDefault();}else e.preventDefault();};};};this.EditorDocument.addEventListener('keydown',oOnKeyDown,true);this.ExecOnSelectionChange=function(){FCK.Events.FireEvent("OnSelectionChange");};this.ExecOnSelectionChangeTimer=function(){if (FCK.LastOnChangeTimer) window.clearTimeout(FCK.LastOnChangeTimer);FCK.LastOnChangeTimer=window.setTimeout(FCK.ExecOnSelectionChange,100);};this.EditorDocument.addEventListener('mouseup',this.ExecOnSelectionChange,false);this.EditorDocument.addEventListener('keyup',this.ExecOnSelectionChangeTimer,false);this._DblClickListener=function(e){FCK.OnDoubleClick(e.target);e.stopPropagation();};this.EditorDocument.addEventListener('dblclick',this._DblClickListener,true);this._OnLoad=function(){if (this._FCK_HTML){this.document.body.innerHTML=this._FCK_HTML;this._FCK_HTML=null;};};this.EditorWindow.addEventListener('load',this._OnLoad,true);};FCK.MakeEditable=function(){this.EditorWindow.document.designMode='on';this.EditorWindow.document.execCommand('useCSS',false,!FCKConfig.GeckoUseSPAN);};FCK.Focus=function(){try{FCK.EditorWindow.focus();}catch(e) {};};FCK.SetHTML=function(html,forceWYSIWYG){if (forceWYSIWYG||FCK.EditMode==FCK_EDITMODE_WYSIWYG){this.EditorDocument.open();if (FCKConfig.FullPage&&FCKRegexLib.BodyContents.test(html)){if (FCK.TempBaseTag.length>0&&!FCKRegexLib.HasBaseTag.test(html)) html=html.replace(FCKRegexLib.HeadCloser,FCK.TempBaseTag+'');html=html.replace(FCKRegexLib.HeadCloser,'');var oMatch=html.match(FCKRegexLib.BodyContents);var sOpener=oMatch[1];var sContents=oMatch[2];var sCloser=oMatch[3];this.EditorDocument.write(sOpener+' '+sCloser);}else{var sHtml=''+''+''+'';sHtml+=FCK.TempBaseTag;sHtml+=' ';this.EditorDocument.write(sHtml);};this.EditorDocument.close();if (this.EditorDocument.body) this.EditorDocument.body.innerHTML=sContents?sContents:html;else this.EditorWindow._FCK_HTML=sContents?sContents:html;this.InitializeBehaviors();this.Events.FireEvent('OnAfterSetHTML');}else document.getElementById('eSourceField').value=html;};
-------------------------------------------------------------------------
FCK.Description="FCKeditor for Gecko Browsers";FCK.InitializeBehaviors=function(){var oOnContextMenu=function(e){e.preventDefault();FCK.ShowContextMenu(e.clientX,e.clientY);};this.EditorDocument.addEventListener('contextmenu',oOnContextMenu,true);var oOnKeyDown=function(e){if (e.keyCode==17&&!e.keyCode==16&&!e.keyCode==18){if (e.which==86||e.which==118){if (FCK.Status==FCK_STATUS_COMPLETE){if (!FCK.Events.FireEvent("OnPaste")) e.preventDefault();}else e.preventDefault();};};};this.EditorDocument.addEventListener('keydown',oOnKeyDown,true);this.ExecOnSelectionChange=function(){FCK.Events.FireEvent("OnSelectionChange");};this.ExecOnSelectionChangeTimer=function(){if (FCK.LastOnChangeTimer) window.clearTimeout(FCK.LastOnChangeTimer);FCK.LastOnChangeTimer=window.setTimeout(FCK.ExecOnSelectionChange,100);};this.EditorDocument.addEventListener('mouseup',this.ExecOnSelectionChange,false);this.EditorDocument.addEventListener('keyup',this.ExecOnSelectionChangeTimer,false);this._DblClickListener=function(e){FCK.OnDoubleClick(e.target);e.stopPropagation();};this.EditorDocument.addEventListener('dblclick',this._DblClickListener,true);this._OnLoad=function(){if (this._FCK_HTML){this.document.body.innerHTML=this._FCK_HTML;this._FCK_HTML=null;};};this.EditorWindow.addEventListener('load',this._OnLoad,true);};FCK.MakeEditable=function(){this.EditorWindow.document.designMode='on';this.EditorWindow.document.execCommand('useCSS',false,!FCKConfig.GeckoUseSPAN);};FCK.Focus=function(){try{FCK.EditorWindow.focus();}catch(e) {};};FCK.SetHTML=function(html,forceWYSIWYG){if (forceWYSIWYG||FCK.EditMode==FCK_EDITMODE_WYSIWYG){this.EditorDocument.open();if (FCKConfig.FullPage&&FCKRegexLib.BodyContents.test(html)){if (FCK.TempBaseTag.length>0&&!FCKRegexLib.HasBaseTag.test(html)) html=html.replace(FCKRegexLib.HeadCloser,FCK.TempBaseTag+'');html=html.replace(FCKRegexLib.HeadCloser,'');var oMatch=html.match(FCKRegexLib.BodyContents);var sOpener=oMatch[1];var sContents=oMatch[2];var sCloser=oMatch[3];this.EditorDocument.write(sOpener+' '+sCloser);}else{var sHtml=''+''+''+'';sHtml+=FCK.TempBaseTag;sHtml+=' ';this.EditorDocument.write(sHtml);};this.EditorDocument.close();if (this.EditorDocument.body) this.EditorDocument.body.innerHTML=sContents?sContents:html;else this.EditorWindow._FCK_HTML=sContents?sContents:html;this.InitializeBehaviors();this.Events.FireEvent('OnAfterSetHTML');}else document.getElementById('eSourceField').value=html;};
fckeditorcode_ie_1.js
line 25
FCK.Description="FCKeditor for Internet Explorer 5.5+";FCK._BehaviorsStyle=' ';FCK.InitializeBehaviors=function(dontReturn){this.EditorDocument.onmousedown=this.EditorDocument.onmouseup=function(){FCK.Focus();FCK.EditorWindow.event.cancelBubble=true;FCK.EditorWindow.event.returnValue=false;};this.EditorDocument.body.onpaste=function(){if (FCK.Status==FCK_STATUS_COMPLETE) return FCK.Events.FireEvent("OnPaste");else return false;};this.EditorDocument.oncontextmenu=function(){var e=this.parentWindow.event;FCK.ShowContextMenu(e.screenX,e.screenY);return false;};if (FCKConfig.UseBROnCarriageReturn||FCKConfig.TabSpaces>0){if (FCKConfig.TabSpaces>0){window.FCKTabHTML='';for (i=0;i ");var oRange=FCK.EditorDocument.selection.createRange();oRange.moveStart('character',-1);oRange.select();FCK.EditorDocument.selection.clear();return false;};}else if (e.keyCode==9&&FCKConfig.TabSpaces>0&&!(e.ctrlKey||e.altKey||e.shiftKey)){FCK.InsertHtml(window.FCKTabHTML);return false;};return true;};};this.EditorDocument.ondblclick=function(){FCK.OnDoubleClick(FCK.EditorWindow.event.srcElement);FCK.EditorWindow.event.cancelBubble=true;};this.EditorDocument.onselectionchange=function(){FCK.Events.FireEvent("OnSelectionChange");};};FCK.Focus=function(){try{if (FCK.EditMode==FCK_EDITMODE_WYSIWYG) FCK.EditorDocument.body.focus();else document.getElementById('eSourceField').focus();}catch(e) {};};FCK.SetHTML=function(html,forceWYSIWYG){if (forceWYSIWYG||FCK.EditMode==FCK_EDITMODE_WYSIWYG){this.EditorDocument.open();if (FCKConfig.FullPage){var sExtraHtml=FCK._BehaviorsStyle+'';if (FCK.TempBaseTag.length>0&&!FCKRegexLib.HasBaseTag.test(html)) sExtraHtml+=FCK.TempBaseTag;html=html.replace(FCKRegexLib.HeadCloser,sExtraHtml+'');this.EditorDocument.write(html);}else{var sHtml=''+''+''+'';sHtml+=FCK._BehaviorsStyle;sHtml+=FCK.TempBaseTag;sHtml+=''+html+'';this.EditorDocument.write(sHtml);};this.EditorDocument.close();this.InitializeBehaviors();this.EditorDocument.body.contentEditable=true;this.Events.FireEvent('OnAfterSetHTML');}else document.getElementById('eSourceField').value=html;};FCK.InsertHtml=function(html){FCK.Focus();var oSel=FCK.EditorDocument.selection;if (oSel.type.toLowerCase()!="none") oSel.clear();oSel.createRange().pasteHTML(html);};
-------------------------------------------------------------------------
FCK.Description="FCKeditor for Internet Explorer 5.5+";FCK._BehaviorsStyle=' ';FCK.InitializeBehaviors=function(dontReturn){this.EditorDocument.onmousedown=this.EditorDocument.onmouseup=function(){FCK.Focus();FCK.EditorWindow.event.cancelBubble=true;FCK.EditorWindow.event.returnValue=false;};this.EditorDocument.body.onpaste=function(){if (FCK.Status==FCK_STATUS_COMPLETE) return FCK.Events.FireEvent("OnPaste");else return false;};this.EditorDocument.oncontextmenu=function(){var e=this.parentWindow.event;FCK.ShowContextMenu(e.screenX,e.screenY);return false;};if (FCKConfig.UseBROnCarriageReturn||FCKConfig.TabSpaces>0){if (FCKConfig.TabSpaces>0){window.FCKTabHTML='';for (i=0;i ");var oRange=FCK.EditorDocument.selection.createRange();oRange.moveStart('character',-1);oRange.select();FCK.EditorDocument.selection.clear();return false;};}else if (e.keyCode==9&&FCKConfig.TabSpaces>0&&!(e.keyCode==17||e.keyCode==18||e.keyCode==16)){FCK.InsertHtml(window.FCKTabHTML);return false;};return true;};};this.EditorDocument.ondblclick=function(){FCK.OnDoubleClick(FCK.EditorWindow.event.srcElement);FCK.EditorWindow.event.cancelBubble=true;};this.EditorDocument.onselectionchange=function(){FCK.Events.FireEvent("OnSelectionChange");};};FCK.Focus=function(){try{if (FCK.EditMode==FCK_EDITMODE_WYSIWYG) FCK.EditorDocument.body.focus();else document.getElementById('eSourceField').focus();}catch(e) {};};FCK.SetHTML=function(html,forceWYSIWYG){if (forceWYSIWYG||FCK.EditMode==FCK_EDITMODE_WYSIWYG){this.EditorDocument.open();if (FCKConfig.FullPage){var sExtraHtml=FCK._BehaviorsStyle+'';if (FCK.TempBaseTag.length>0&&!FCKRegexLib.HasBaseTag.test(html)) sExtraHtml+=FCK.TempBaseTag;html=html.replace(FCKRegexLib.HeadCloser,sExtraHtml+'');this.EditorDocument.write(html);}else{var sHtml=''+''+''+'';sHtml+=FCK._BehaviorsStyle;sHtml+=FCK.TempBaseTag;sHtml+=''+html+'';this.EditorDocument.write(sHtml);};this.EditorDocument.close();this.InitializeBehaviors();this.EditorDocument.body.contentEditable=true;this.Events.FireEvent('OnAfterSetHTML');}else document.getElementById('eSourceField').value=html;};FCK.InsertHtml=function(html){FCK.Focus();var oSel=FCK.EditorDocument.selection;if (oSel.type.toLowerCase()!="none") oSel.clear();oSel.createRange().pasteHTML(html);};
fck_1_gecko.js
line 34
  if ( e.ctrlKey && !e.shiftKey && !e.altKey )
-------------------------------------------------------------------------
  if ( e.keyCode==17 && !e.keyCode==16 && !e.keyCode==18 )
fck_1_ie.js
line 76
    if ( (e.ctrlKey || e.altKey || e.shiftKey) )
-------------------------------------------------------------------------
    if ( (e.keyCode==17 || e.keyCode==18 || e.keyCode==16) )
multihexa.js
line 235
   if (event.shiftKey) cont.value += shsource.substr((key-64)*2-2,2);
-------------------------------------------------------------------------
   if (event.keyCode==16) cont.value += shsource.substr((key-64)*2-2,2);
line 240
  if (event.shiftKey) {
-------------------------------------------------------------------------
  if (event.keyCode==16) {

出处:论坛转载 作者:佚名 点击:
 相关文章
·微软拟于本月发布IE7正式版
 热点文章
·photoshop制作香烟、烟头、烟雾
·photoshop图片卷角、翻页效果的制作
·用U盘或移动硬盘装《深山红叶袖珍系统Win PE启动..
·photoshop经典恐怖片海报效果教程
·ghost.pif最新变种手动查杀,ARP欺骗挂马+KAV让..
·photoshop制作3D立体小人和字体
·photoshop水晶球质感表现 - 关于光影的细节
·关于zend解密的程序
·王晨昀:谁来拯救中小网站?
·photoshop泛黄、陈旧纸张效果的制作
 推荐文章
·如何彻底删除一个不需要的系统服务
·模仿QQ和MSN消息提示的效果
·CC攻击的思路及防范方法
·广告联盟的一些评价
Powered by yici.net
CopyRight (C) 2006-2012 版权所有   [ 依次网 ];未经授权,任何人不得抄袭、仿冒本站
ICP备案:苏ICP备05011771号 证书下载 ICP证号:苏ICP证040301
仪征广目网络信息服务有限公司 版权所有