📄 fck_select.js
字号:
/** FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http:
*
* For further information visit:
* http:
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fck_select.js
* Scripts for the fck_select.html page.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
function Select( combo )
{ var iIndex = combo.selectedIndex ;
oListText.selectedIndex = iIndex ; oListValue.selectedIndex = iIndex ;
var oTxtText = document.getElementById( "txtText" ) ; var oTxtValue = document.getElementById( "txtValue" ) ;
oTxtText.value = oListText.value ; oTxtValue.value = oListValue.value ; }
function Add()
{ var oTxtText = document.getElementById( "txtText" ) ; var oTxtValue = document.getElementById( "txtValue" ) ;
AddComboOption( oListText, oTxtText.value, oTxtText.value ) ; AddComboOption( oListValue, oTxtValue.value, oTxtValue.value ) ;
oListText.selectedIndex = oListText.options.length - 1 ; oListValue.selectedIndex = oListValue.options.length - 1 ;
oTxtText.value = '' ; oTxtValue.value = '' ;
oTxtText.focus() ; }
function Modify()
{ var iIndex = oListText.selectedIndex ;
if ( iIndex < 0 ) return ;
var oTxtText = document.getElementById( "txtText" ) ; var oTxtValue = document.getElementById( "txtValue" ) ;
oListText.options[ iIndex ].innerHTML = oTxtText.value ; oListText.options[ iIndex ].value = oTxtText.value ;
oListValue.options[ iIndex ].innerHTML = oTxtValue.value ; oListValue.options[ iIndex ].value = oTxtValue.value ;
oTxtText.value = '' ; oTxtValue.value = '' ;
oTxtText.focus() ; }
function Move( steps )
{ ChangeOptionPosition( oListText, steps ) ; ChangeOptionPosition( oListValue, steps ) ; }
function Delete()
{ RemoveSelectedOptions( oListText ) ; RemoveSelectedOptions( oListValue ) ; }
function SetSelectedValue()
{ var iIndex = oListValue.selectedIndex ; if ( iIndex < 0 ) return ;
var oTxtValue = document.getElementById( "txtSelValue" ) ;
oTxtValue.value = oListValue.options[ iIndex ].value ; }
function ChangeOptionPosition( combo, steps )
{ var iActualIndex = combo.selectedIndex ;
if ( iActualIndex < 0 )
return ;
var iFinalIndex = iActualIndex + steps ;
if ( iFinalIndex < 0 )
iFinalIndex = 0 ;
if ( iFinalIndex > ( combo.options.length - 1 ) )
iFinalIndex = combo.options.length - 1 ;
if ( iActualIndex == iFinalIndex )
return ;
var oOption = combo.options[ iActualIndex ] ; var sText = oOption.innerHTML ; var sValue = oOption.value ;
combo.remove( iActualIndex ) ;
oOption = AddComboOption( combo, sText, sValue, null, iFinalIndex ) ;
oOption.selected = true ; }
function RemoveSelectedOptions(combo)
{ var iSelectedIndex = combo.selectedIndex ;
var oOptions = combo.options ;
for ( var i = oOptions.length - 1 ; i >= 0 ; i-- )
{ if (oOptions[i].selected) combo.remove(i) ; }
if ( combo.options.length > 0 )
{ if ( iSelectedIndex >= combo.options.length ) iSelectedIndex = combo.options.length - 1 ; combo.selectedIndex = iSelectedIndex ; }
}
function AddComboOption( combo, optionText, optionValue, documentObject, index )
{ var oOption ;
if ( documentObject )
oOption = documentObject.createElement("OPTION") ; else
oOption = document.createElement("OPTION") ;
if ( index != null )
combo.options.add( oOption, index ) ; else
combo.options.add( oOption ) ;
oOption.innerHTML = optionText.length > 0 ? optionText : ' ' ; oOption.value = optionValue ;
return oOption ; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -