zoukankan      html  css  js  c++  java
  • FCKEditor 打开页面总是得到焦点问题处理 FCKConfig.StartupFocus=false;

    fckconfig.js 配置文件中的 “FCKConfig.StartupFocus=false;”设置,在FCKEditor编辑器在新窗口中打开是有效的,但是如果FCKEditor编辑器所在页面内嵌在一个框架页面中打开时,这个设置就会失去作用,每次打开页面都会自动到焦点定位到FCKEditor编辑器,当页面较长时,这是很让人心烦的。

    不得已,只好使用一些小技巧解决这个问题。

    以下是FCKEditor编辑器内嵌到页面的代码
    <input id="content___Config" type="hidden" />
    <iframe id="content___Frame" frameborder="0" height="300" scrolling="no" src="../Res/FCKEditor/fckeditor.html?InstanceName=content&Toolbar=Default"  width="100%"></iframe>

    我们在页面底部添加以下JS代码,先把FCKEditor编辑器隐藏起来,然后过一秒后显示FCKEditor编辑器,这样就可以达到一打开页面不让FCKEditor编辑器得到焦点的目的,实现原理是:因为刚打开时,FCKEditor编辑器没有显示,所以无法得到焦点,在自动设置焦点的代码执行过后,再显示,FCKEditor编辑器就不会得到焦点了。
    <script>
    document.getElementById("content___Frame").style.display="none";
    function pageFocus(){
    document.getElementById("content___Frame").style.display="block";
    }
    setTimeout("pageFocus()",1000);
    </script>

    以下代码也可以,但是页面会抖动,所以不太满意。
    <script>
    function pageFocus(){
    window.scrollTo(0,0);

    }
    setTimeout("pageFocus()",1000);
    </script>
  • 相关阅读:
    XML DOM介绍和例子
    关于IFRAME 自适应高度的研究
    UrlReWriter 使用经验小结
    ASP无限分类数据库版
    全国天气预报代码
    可输入的下拉框
    web2.0_RSS_.net读写
    ASP与存储过程[转帖]
    NetBox Asp Web服务器
    css里可以加表达式 :expression
  • 原文地址:https://www.cnblogs.com/lljinz/p/2020591.html
Copyright © 2011-2022 走看看