Table Properties
var oEditor = window.parent.InnerDialogLoaded() ;
// Gets the document DOM
var oDOM = oEditor.FCK.EditorDocument ;
// Gets the table if there is one selected.
var table ;
var e = oEditor.FCKSelection.GetSelectedElement() ;
if ( ! e && document.location.search.substr(1) == 'Parent' )
e = oEditor.FCKSelection.MoveToAncestorNode( 'TABLE' ) ;
if ( e && e.tagName == "TABLE" )
table = e ;
// Fired when the window loading process is finished. It sets the fields with the
// actual values if a table is selected in the editor.
window.onload = function()
{
// First of all, translate the dialog box texts
oEditor.FCKLanguageManager.TranslatePage(document) ;
if (table)
{
document.getElementById('txtRows').value = table.rows.length ;
document.getElementById('txtColumns').value = table.rows[0].cells.length ;
// Gets the value from the Width or the Style attribute
var iWidth = (table.style.width ? table.style.width : table.width ) ;
var iHeight = (table.style.height ? table.style.height : table.height ) ;
if (iWidth.indexOf('%') >= 0) // Percentual = %
{
iWidth = parseInt( iWidth.substr(0,iWidth.length - 1) ) ;
document.getElementById('selWidthType').value = "percent" ;
}
else if (iWidth.indexOf('px') >= 0) // Style Pixel = px
{ //
iWidth = iWidth.substr(0,iWidth.length - 2);
document.getElementById('selWidthType').value = "pixels" ;
}
if (iHeight && iHeight.indexOf('px') >= 0) // Style Pixel = px
iHeight = iHeight.substr(0,iHeight.length - 2);
document.getElementById('txtWidth').value = iWidth ;
document.getElementById('txtHeight').value = iHeight ;
document.getElementById('txtBorder').value = table.border ;
document.getElementById('selAlignment').value = table.align ;
document.getElementById('txtCellPadding').value = table.cellPadding ;
document.getElementById('txtCellSpacing').value = table.cellSpacing ;
// document.getElementById('cmbFontStyle').value = table.className ;
if (table.caption) document.getElementById('txtCaption').value = table.caption.innerText ;
document.getElementById('txtRows').disabled = true ;
document.getElementById('txtColumns').disabled = true ;
}
window.parent.SetOkButton( true ) ;
window.parent.SetAutoSize( true ) ;
}
// Fired when the user press the OK button
function Ok()
{
var bExists = ( table != null ) ;
if ( ! bExists )
{
table = document.createElement( "TABLE" ) ;
}
// Removes the Width and Height styles
if ( bExists && table.style.width ) table.style.width = null ; //.removeAttribute("width") ;
if ( bExists && table.style.height ) table.style.height = null ; //.removeAttribute("height") ;
table.width = document.getElementById('txtWidth').value + ( document.getElementById('selWidthType').value == "percent" ? "%" : "") ;
table.height = document.getElementById('txtHeight').value ;
table.border = document.getElementById('txtBorder').value ;
table.align = document.getElementById('selAlignment').value ;
table.cellPadding = document.getElementById('txtCellPadding').value ;
table.cellSpacing = document.getElementById('txtCellSpacing').value ;
// table.className = cmbFontStyle.value ;
if ( document.getElementById('txtCaption').value != '')
{
if (! table.caption) table.createCaption() ;
table.caption.innerText = document.getElementById('txtCaption').value ;
}
// else if ( bExists && table.caption )
// table.deleteCaption() ; // TODO: It causes an IE internal error.
if (! bExists)
{
var iRows = document.getElementById('txtRows').value ;
var iCols = document.getElementById('txtColumns').value ;
for ( var r = 0 ; r < iRows ; r++ )
{
var oRow = table.insertRow(-1) ;
for ( var c = 0 ; c < iCols ; c++ )
{
var oCell = oRow.insertCell(-1) ;
if ( oEditor.FCKBrowserInfo.IsGecko )
oCell.innerHTML = '' ;
//oCell.innerHTML = " " ;
}
}
oEditor.FCKUndo.SaveUndoStep() ;
oEditor.FCK.InsertElement( table ) ;
}
return true ;
}
function IsDigit( e )
{
e = e || event ;
var iCode = ( e.keyCode || e.charCode ) ;
return
(
( iCode >= 48 && iCode = 37 && iCode
Caption:
Wyszukiwarka
Podobne podstrony:
fck tablelanai dinning tablefck anchorThe Complete Pentium Instruction Set Table (32 Bit Addressing Mode Only)insert table buttoncurio tabletiled coffee tablefck pastewięcej podobnych podstron