⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialog.js

📁 广州物价系统开发部分模块
💻 JS
字号:
// 载入页面
function LoadInnerDialog()
{
	if ( window.onresize )
		window.onresize() ;

	window.frames["frmMain"].document.location.href = window.dialogArguments.Page ;
	document.getElementById("frmMain").onreadystatechange = function(){
		if( this.readyState == "complete" && !this.__State){
			this.__State = true;
			SetAutoSize( true );
		}
	}
}

function SetOkButton( showIt )
{
	document.getElementById('btnOk').style.visibility = ( showIt ? '' : 'hidden' ) ;
}

var bAutoSize = false ;

function SetAutoSize( autoSize )
{
	bAutoSize = autoSize ;
	RefreshSize() ;
}

function RefreshSize()
{
	if ( bAutoSize )
	{
		var oInnerDoc = document.getElementById('frmMain').contentWindow.document ;

		var iFrameHeight ;
		if ( document.all )
			iFrameHeight = oInnerDoc.body.offsetHeight ;
		else
			iFrameHeight = document.getElementById('frmMain').contentWindow.innerHeight ;

		var iInnerHeight = oInnerDoc.body.scrollHeight ;

		var iDiff = iInnerHeight - iFrameHeight ;

		if ( iDiff > 0 )
		{
			if ( document.all )
				window.dialogHeight = ( parseInt( window.dialogHeight ) + iDiff ) + 'px' ;
			else
				window.resizeBy( 0, iDiff ) ;
		}
		// winder 2006-5-15 增加 实际高度小于页面大小
		else{
			if ( document.all )
				window.dialogHeight = ( parseInt( window.dialogHeight ) + iDiff ) + 'px' ;
			else
				window.resizeBy( 0, iDiff ) ;
		}
	}
}

function Ok()
{
	if ( window.frames["frmMain"].Ok && window.frames["frmMain"].Ok() )
		Cancel() ;
}

function Cancel()
{
	window.close() ;
}

// 选项卡对象
var oTabs = new Object() ;

function TabDiv_OnClick()
{
	SetSelectedTab( this.TabCode ) ;
}

function AddTab( tabCode, tabText, startHidden )
{
	if ( typeof( oTabs[ tabCode ] ) != 'undefined' )
		return ;

	var eTabsRow = document.getElementById( 'Tabs' ) ;

	var oCell = eTabsRow.insertCell(  eTabsRow.cells.length - 1 ) ;
	oCell.noWrap = true ;

	var oDiv = document.createElement( 'DIV' ) ;
	oDiv.className = 'PopupTab' ;
	oDiv.innerHTML = tabText ;
	oDiv.TabCode = tabCode ;
	oDiv.onclick = TabDiv_OnClick ;

	if ( startHidden )
		oDiv.style.display = 'none' ;

	eTabsRow = document.getElementById( 'TabsRow' ) ;

	oCell.appendChild( oDiv ) ;

	if ( eTabsRow.style.display == 'none' )
	{
		var eTitleArea = document.getElementById( 'TitleArea' ) ;
		eTitleArea.className = 'PopupTitle' ;

		oDiv.className = 'PopupTabSelected' ;
		eTabsRow.style.display = '' ;

		if ( ! window.dialogArguments.Editor.FCKBrowserInfo.IsIE )
			window.onresize() ;
	}

	oTabs[ tabCode ] = oDiv ;
	oTabs[ tabCode ].Index = oTabs.length - 1 ;
}

function SetSelectedTab( tabCode )
{
	for ( var sCode in oTabs )
	{
		if ( sCode == tabCode )
			oTabs[sCode].className = 'PopupTabSelected' ;
		else
			oTabs[sCode].className = 'PopupTab' ;
	}

	if ( typeof( window.frames["frmMain"].OnDialogTabChange ) == 'function' )
		window.frames["frmMain"].OnDialogTabChange( tabCode ) ;
}

function SetTabVisibility( tabCode, isVisible )
{
	var oTab = oTabs[ tabCode ] ;
	oTab.style.display = isVisible ? '' : 'none' ;

	if ( ! isVisible && oTab.className == 'PopupTabSelected' )
	{
		for ( var sCode in oTabs )
		{
			if ( oTabs[sCode].style.display != 'none' )
			{
				SetSelectedTab( sCode ) ;
				break ;
			}
		}
	}
}

// 按键事件
function SetOnKeyDown( targetDocument )
{
	targetDocument.onkeydown = function ( e )
	{
		e = e || event || this.parentWindow.event ;
		switch ( e.keyCode )
		{
			case 13 :		// ENTER
				var oTarget = e.srcElement || e.target ;
				if ( oTarget.tagName == 'TEXTAREA' ) return ;
				Ok() ;
				return false ;
			case 27 :		// ESC
				Cancel() ;
				return false ;
				break ;
		}
		return true ;
	}
}

function Window_OnBeforeUnload()
{
	for ( var t in oTabs )
		oTabs[t] = null ;
}

⌨️ 快捷键说明

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