`

fckeditor 使用js创建 editor

    博客分类:
  • js
阅读更多

如何赋初始值?

 

 

<%@ page language="java"  pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'add-user.jsp' starting page</title>
    <link rel="stylesheet" type="text/css" href="css/comm-tab.css">
    <script type="text/javascript" src="../fckeditor/fckeditor.js"></script>  
 
  <script  type="text/javascript">
  window.onload = function() {
  var oFCKeditor = new FCKeditor('userComm');
  oFCKeditor.BasePath = "../fckeditor/";
  oFCKeditor.ToolbarSet="Me";
  oFCKeditor.ReplaceTextarea();
 }
  
 function info_submit() {
  var f=document.leaderForm;
  if (f.loginName.value == "")
  {
   alert("请填写用户名!");
   f.loginName.focus();
   return false;

  }
  if (f.userName.value == "")
  {
   alert("真名不能为空!");
   document.info.infoTitle.focus();
   return false;
  }
  if (FCKeditorAPI.GetInstance("userComm").EditorDocument.body.innerText.length == 0||FCKeditorAPI.GetInstance("infoComm").GetXHTML(false) == "")
  {
   alert("备注不能为空!");
   FCKeditorAPI.GetInstance("infoComm").Focus();
   return false;
  }
  if (document.info.userId.value == "")
  {
   alert("录入人不能为空!");
   document.info.userId.focus();
   return false;
  }
 }
 </script>
  </head>
 
  <body>
  <form action="addLeader.hnyxsm" method="post" name="leaderForm">
   <table align="center" width="80%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce" onmouseover="changeto()"  onmouseout="changeback()">
   <tr><td colspan="4" height="20" bgcolor="d3eaef" class="STYLE6" align="center">添加新领导</td></tr>
   <tr><td width="15%" height="20" align="center" bgcolor="#FFFFFF"  class="STYLE6">用户名:</td><td  class="STYLE19" bgcolor="#FFFFFF" ><input type="text" name="loginName"></td>
     <td width="15%" height="20" align="center" bgcolor="#FFFFFF"  class="STYLE6">真名:</td><td  class="STYLE19" bgcolor="#FFFFFF" ><input type="text" name="userName"></td></tr>
    <tr><td width="15%" height="20" align="center" bgcolor="#FFFFFF"  class="STYLE6">密码:</td><td  class="STYLE19" bgcolor="#FFFFFF" ><input type="password" name="password"></td>
      <td width="15%" height="20" align="center" bgcolor="#FFFFFF"  class="STYLE6">确认密码:</td><td  class="STYLE19" bgcolor="#FFFFFF" ><input type="password" name="password2"></td></tr>
    <tr><td width="15%" height="20" align="center" bgcolor="#FFFFFF"  class="STYLE6">身份证号:</td><td  class="STYLE19" bgcolor="#FFFFFF" ><input name="userCardId" type="text"> </td>
      <td width="15%" height="20" align="center" bgcolor="#FFFFFF"  class="STYLE6">邮箱:</td><td  class="STYLE19" bgcolor="#FFFFFF" ><input type="text" name="userEmail"></td></tr>
    <tr><td width="15%" height="20" align="center" bgcolor="#FFFFFF"  class="STYLE6">住址:</td><td  class="STYLE19" bgcolor="#FFFFFF" ><input type="text" name="userAddr"></td>
      <td width="15%" height="20" align="center" bgcolor="#FFFFFF"  class="STYLE6">是否审核:</td><td  class="STYLE19" bgcolor="#FFFFFF" >是: <input type="radio" name="userCheckFlag" value="1"> 否: <input type="radio" name="userCheckFlag" value="0"></td></tr>
    <tr><td width="15%" height="20" align="center" bgcolor="#FFFFFF"  class="STYLE6">备注:</td><td colspan="3" class="STYLE19" bgcolor="#FFFFFF" ><textarea rows="5" cols="60" name="userComm">${user.userComm}</textarea></td></tr>
    <tr><td colspan="4" align="center"><input type="submit" value="添加"><input type="reset" value="取消"></td></tr>
   </table>
  </form>
  

  </body>
</html>

 

--------------------------

 

  • 在网页中创建一个textarea,一定要命名其id.
  • 应用Fckeditor.
    <script src="../../../koncer/" type="text/javascript"></script> <script language="javascript" type="text/javascript" src="你的fckeditor.js所在的位置/fckeditor.js"></script>
       <script language="javascript" type="text/javascript">
       window.onload = function() {
        var oEditor = new FCKeditor('你命名的Textarea的Id','700px','300px') ;
        oEditor.BasePath= 'FCKeditor所处的相对站点的路径/FCKeditor/' ;
        oEditor.ToolbarSet="设置工具栏";//可选的参数可以在fckeditor.js位置相同的文件夹中fckconfig.js中找到也可以设置自己需要的Toolbar
        oEditor.ReplaceTextarea() ;
       }
       function copyIt(){
        var oEditor = FCKeditorAPI.GetInstance('你命名的Textarea的Id');
        oEditor.UpdateLinkedField();
        window.clipboardData.setData("Text", document.getElementById("你命名的Textarea的Id").innerHTML);
    <script type="text/javascript"></script><script src="../../../koncer/" type="text/javascript"></script>    }  </script>
分享到:
评论

相关推荐

    fckeditor.js文件中文注释

    FCKeditor是一款广泛使用的开源富文本编辑器,其核心文件便是fckeditor.js。本文将对这个文件的中文注释进行详细解读,帮助开发者更好地理解和使用FCKeditor。 首先,fckeditor.js是FCKeditor的核心JavaScript文件...

    FCKeditor 使用指南及 JavaScript 调用

    **FCKeditor 使用指南及 JavaScript 调用** FCKeditor 是一款开源的富文本编辑器,它在Web开发中广泛用于提供用户友好的在线文本编辑功能。通过JavaScript调用,开发者可以轻松地将FCKeditor集成到网页中,允许用户...

    fckeditor的MVC版及js使用fckeditor的方法

    **fckeditor的MVC版及js使用fckeditor的方法** 在Web开发中,富文本编辑器是一种常见的工具,它允许用户以类似Word的方式编辑HTML内容。FCKeditor(现已更名为CKEditor)是早年间非常流行的一款开源富文本编辑器。...

    fckeditor php使用配置

    3. **创建实例**:在页面的部分,通过JavaScript创建FCKeditor实例。例如: ```javascript var oFCKeditor = new FCKeditor( 'editor1' ) ; oFCKeditor.BasePath = '/path/to/fckeditor/' ; oFCKeditor.Value = ...

    FCKeditor demo(用JS方式)

    一旦库被加载,你可以通过JavaScript创建FCKeditor实例。这通常在DOM加载完成后执行,例如在`window.onload`或`$(document).ready`事件中。以下是如何创建一个基本的FCKeditor实例: ```javascript var oFCKeditor ...

    FCKeditor 使用笔记

    2. **创建自定义JSP文件**:在JSP文件中引入FCKeditor的自定义标签库,并使用自定义的`&lt;FCK:editor&gt;`标签。 ```jsp &lt;%@ taglib uri="http://java.fckeditor.net" prefix="FCK" %&gt; &lt;FCK:editor instanceName=...

    FCKeditor使用指南

    &lt;script type="text/javascript" src="/path/to/fckeditor/fckeditor.js"&gt; &lt;textarea id="editor1" name="editor1"&gt; &lt;script type="text/javascript"&gt; FCKeditor_OnComplete = function() { // 完成后回调 }; ...

    fckeditor3.6(java js 实例

    &lt;script type="text/javascript" src="fckeditor/editor/fckeditor.js"&gt; ``` 然后创建编辑器实例: ```jsp &lt;script type="text/javascript"&gt; var oFCKeditor = new FCKeditor('editor1') ; oFCKeditor....

    FCKeditor 2.6.6 可直接使用

    1. **富文本编辑**:FCKeditor支持插入图片、创建链接、格式化文本、插入表格等多种富文本编辑功能,提供接近桌面应用的编辑体验。 2. **多语言支持**:FCKeditor内置多种语言包,便于满足全球用户的使用需求。 3....

    FCKEditor与ext结合使用

    3. **初始化FCKEditor**:使用FCKeditor的API进行初始化,指定刚刚创建的div作为编辑器的工作区。 4. **事件绑定**:根据需要,可以监听FCKEditor的事件(如`OnBlur`、`OnFocus`),并用EXT的方法处理这些事件。 5. ...

    FCKEditor完整使用说明--一步步教你使用FCKeditor插件

    4. **初始化编辑器**:在需要使用FCKeditor的地方,创建编辑器实例: ```javascript var oFCKeditor = new FCKeditor( 'editor' ) ; oFCKeditor.BasePath = "/js/fckeditor/" ; // 设置FCKeditor的基础路径 ...

    ASP.NET mvc使用FCKeditor.zip在线编辑器示例

    一个用于展示FCKeditor的视图可能命名为`Editor.cshtml`,在这里,开发者会使用HTML和Razor语法嵌入FCKeditor的JavaScript库,并设置编辑器的配置。 `Content`目录通常存储静态资源,如CSS样式表和JavaScript文件。...

    FCKeditor使用方法详解.docx

    - **适合Ajax的调用方法**:针对动态内容,可以使用JavaScript创建编辑器并绑定到某个`div`元素。 4. **FCKeditor的常用设置** - FCKeditor的配置主要在`fckconfig.js`文件中进行。你可以自定义工具栏按钮,例如...

    fckeditor组件及其使用方法详解

    &lt;script type="text/javascript" src="/editor/fckeditor.js"&gt; ``` **二、创建和初始化FCKeditor** 1. **创建编辑器实例**: 在HTML中,你需要定义一个`&lt;textarea&gt;`标签作为FCKeditor的载体。然后在JavaScript中...

    FCKeditor使用方法详解.doc

    1. **创建编辑器实例**: 使用JavaScript代码创建FCKeditor实例,例如: ```javascript var oFCKeditor = new FCKeditor( 'editor' ) ; oFCKeditor.BasePath = '/fckeditor/' ; oFCKeditor.Value = '' ; // 初始...

    jsp中使用FCKEditor

    2. **部署资源**:将解压后的FCKeditor文件夹放置到JSP项目的WebContent目录下,通常会将其放在一个合适的子目录如`editor`或`js`中。 3. **引入JavaScript库**:在需要使用FCKEditor的JSP页面中,通过`&lt;script&gt;`...

    FCKeditor配置for java

    &lt;script type="text/javascript" src="fckeditor/editor/fckeditor.js"&gt; ``` 确保路径正确指向你项目中的FCKeditor文件。 4. **初始化FCKeditor** 在页面中,你需要创建一个`&lt;textarea&gt;`元素,用于被FCKeditor替换...

    FCKeditor详细使用说明

    &lt;script type="text/javascript" src="fckeditor/fckeditor.js"&gt; ``` 2. 在`&lt;body&gt;`标签内创建FCKeditor实例: ```javascript var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ; oFCKeditor.BasePath="/1_9/...

Global site tag (gtag.js) - Google Analytics