第一步 在语言文件中加入 button的name和名称的键值 +展开
-JavaScript
UpFileBtn :"上传文件",
+展开
-JavaScript
case 'File' : oItem = new FCKToolbarButton( 'File' , FCKLang.UpFileBtn, FCKLang.UpFileBtn, null, false, true, null) ; break ;
+展开
-JavaScript
var FCKToolbarButton = function( commandName, label, tooltip, style, sourceView, contextSensitive, icon ) { this.CommandName = commandName ; this.Label = label ; this.Tooltip = tooltip ; this.Style = style ; this.SourceView = sourceView ? true : false ; this.ContextSensitive = contextSensitive ? true : false ; if ( icon == null ) this.IconPath = FCKConfig.SkinPath + 'toolbar/' + commandName.toLowerCase() + '.gif' ; else if ( typeof( icon ) == 'number' ) this.IconPath = [ FCKConfig.SkinPath + 'fck_strip.gif', 16, icon ] ; else this.IconPath = icon ; }
+展开
-JavaScript
case 'File' : oCommand = new FCKDialogCommand( 'File' , FCKLang.UpFileBtn , 'dialog/fck_file.html' , 450, 390 ) ; break ;
+展开
-JavaScript
var oEditor = window.parent.InnerDialogLoaded() ; var FCK = oEditor.FCK ; var FCKLang = oEditor.FCKLang ; var FCKConfig = oEditor.FCKConfig ; var FCKDebug = oEditor.FCKDebug ; var bPreviewInitialized ; window.onload = function() { window.parent.SetOkButton( true ) ;//"确定"按钮可以用 } function Ok()//“确定"相应事件 { if ( GetE('txtUrl').value.length == 0 )//源文件 { alert("请选择文件!"); return false ; } var oFile; oFile = FCK.EditorDocument.createElement( 'a' ) ; oFile.href = GetE('txtUrl').value ; oFile.target = '_blank'; oFile.innerHTML = GetE('txtFileName').value ;//显示文字 oFile = FCK.InsertElementAndGetIt( oFile ) ; return true ; }
+展开
-HTML
<html> <head> <title>上传文件</title> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script src="fck_files/fck_files.js" type="text/javascript"></script> </head> <body scroll="no" style="overflow: hidden"> <div id="divInfo"> <table cellspacing="0" cellpadding="0" width="100%" border="0"> <tr> <td width="100%"> <span>源文件</span> </td> </tr> <tr> <td valign="top"> <input id="txtUrl" style="width: 100%" type="text" /> </td> </tr> <tr> <td width="100%"> <span>显示文本</span> </td> </tr> <tr> <td valign="top"> <input id="txtFileName" style="width: 100%" type="text" /> </td> </tr> <tr> <td> <input id="btnupload" type="button" value="上传文件" style="font-size: 8pt;" /> </td> </tr> </table> </div> </body> </html>
|
|
来自: yanjj > 《Javascript》