frame.js

来自「Hippo CMS是一个以信息为中心的开源内容管理系统。Hippo CMS目标是」· JavaScript 代码 · 共 65 行

JS
65
字号
/*
* Copyright 2001-2007 Hippo (www.hippo.nl)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function iFrameHeight2() 
{ 
  var h = 0;
  if (typeof window.top.window.frames['topframe'] != 'undefined'){
    if(document.all) // Internet.Explorer
    { 
    	 var parentIFrame = parent.document.getElementById('hippoFrame');
       var toolbar = parent.document.getElementById('toolbarDiv2');
       
    	 var editorHeight = document.body.offsetHeight;
    	 var editorWidth = document.body.offsetWidth;
    	 
    	 var difWidth = window.top.window.frames['topframe'].document.body.offsetWidth - editorWidth;
    	 parentIFrame.width = editorWidth + difWidth;
  
    	 var toolbarheight = toolbar.offsetHeight;  	 
    	 var winHeight = window.top.document.body.offsetHeight;
    	 // var topHeight = window.top.window.frames['topframe'].document.body.offsetHeight;
    	 var diff = winHeight - 100 - toolbarheight;
  
    	 parentIFrame.height = diff;
     	 parentIFrame.style.display='inline';
    } 
    else // fireox.0.9.2 + ; netscape.7.0 +
    {    
       var toolbar = parent.document.getElementById('toolbarDiv2');
    	 var parentIFrame = parent.document.getElementById('hippoFrame');
    	 
    	 var editorWidth = document.body.offsetWidth;  	 
    	 var difWidth = window.top.window.frames['topframe'].document.body.offsetWidth - editorWidth;  	 
    	 parentIFrame.width = editorWidth + difWidth;
    	 
    	 var windowHeight = window.top.innerHeight;
    	 
    	 var topHeight = window.top.window.frames['topframe'].innerHeight;
    	 var toolbarheight = toolbar.offsetHeight;  	   
    	 var diff = (window.top.innerHeight - topHeight - toolbarheight - 10);  	 
    	 parentIFrame.height = diff;
     	 parentIFrame.style.display='inline';
    }
  } 
}

function iFrameHeight(){
  var toolbar = parent.document.getElementById('toolbarDiv2');
  if (toolbar == null || typeof toolbar == 'undefined')
     setTimeout(iFrameHeight,100);
  else 
     iFrameHeight2();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?