在页面中使用tinyMce

在jsp页面中使用tinymce
<%@ page language="java" pageEncoding="GBK"%>
<%@ page contentType="text/html; charset=GBK"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c"%>
<%@ taglib uri="/WEB-INF/jpager.tld" prefix="page"%>
<%@ taglib uri="/WEB-INF/cvicse-param.tld" prefix="param"%>
<%
	response.setHeader("Pragma", "No-cache");//HTTP 1.1 
	response.setHeader("Cache-Control", "no-cache");//HTTP 1.0 
	response.setHeader("Expires", "0");//防止被proxy
%>
<html>
<head>
<title>NewsLetter添加修改</title>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<link type="text/css" rel="stylesheet" href="css/aaabbb.css">
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jscripts/tiny_mce/tiny_mce.js">
</script>

<script type="text/javascript">
	
	tinyMCE.init({
		// General options
		mode : "exact",
		elements : "content",
		theme : "advanced",
		skin : "o2k7",
		plugins : "advlink,pagebreak,style,table,emotions,insertdatetime,preview,searchreplace,print,paste,directionality,fullscreen,nonbreaking,inlinepopups",

		// Theme options
		theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,link,unlink,|,code,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,|,sub,sup,|charmap,emotions,advhr,|,print,|,ltr,rtl,|,fullscreen,|,nonbreaking,pagebreak,image",

		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		// theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,
		// 图片等URL加全路径
		relative_urls: false,
   		remove_script_host: false,

		// Example content CSS (should be your site CSS)
		content_css : "${pageContext.request.contextPath}/js/jscripts/tiny_mce/stylecss/content.css",//必须有,供样式选择用

		// Drop lists for /image/template dialogs
		template_external_list_url : "../js/jscripts/tiny_mce/lists/template_list.js",
		// external_image_list_url : "../js/jscripts/tiny_mce/lists/image_list.js",

		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	});

	function Save(){
		 with(document.forms[0]){
			if(title.value == "" || title.value==null){
				alert("请输入邮件标题!");
				return false;
			}
			// replace(/^\s*|[\x00-\x1f]|\s*$/g,   '') 去掉textarea中不可见字符
			if(content.value == "" || content.value==null){
				alert("请输入邮件正文!");
				return false;
			}
			if (id.value == "") {
				operFlag.value = "add";
			} else {
				operFlag.value = "update";
			}
			// alert(operFlag.value);
			submit();
		 }	
	}
	function Back(){
		 with(document.forms[0]){
			document.getElementById("title").value = "";
			document.getElementById("content").value = "";
			action="<%=request.getContextPath()%>/letter.do";
			submit();
		 }
	}
</script>
</head>
<%
	String id = (String) request.getAttribute("id");
	if (id == null || id.equals("")) {
		id = "";
	}
	
%>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<center>
<br>
<br>
<br>
<html:form styleId="letterForm" action="letterEdit.do?method=letteraddedit" method="post">
	<html:hidden name="letterForm" property="operFlag" styleId="operFlag" />
	<html:hidden name="letterForm" property="id" styleId="id" />
	<div align="left"><html:errors /></div>
	
  <table  width="100%" border="0" cellpadding="1" cellspacing="0"
				bordercolor="#126DC9" bgcolor="#f2f8ff"
				style="border-collapse: collapse">
    <thead>
		<tr align="center">
			<th colspan="4">
				邮件<%
					if ("".equals(id)) {
					out.print("添加");
				} else {
					out.print("修改");
				}
			%>
			</th>
		</tr>
	</thead>
	<tr> 
      <td valign="middle"> <div align="right">邮件标题 :</div></td>
      <td height="25">
      	<input id="title" type="text" name="title" value="${title }" style="width:60%;height: 100%;line-height: 23px"/>
      </td>
	</tr>
	
	<tr height="330" valign="top"> 
      <td valign="top"> <div align="right">邮件正文 :</div></td>
      <td>
      	<textarea id="content" name="content" rows="30" cols="130" style="width: 100%">
      	<c:out value="${content}" escapeXml="false"></c:out>
		</textarea>
      </td>
	</tr>
    <tr bgcolor="f5f5f5"> 
      <td colspan="2"> <div align="center"> 
      	<input type="button"  value=" 保存 " οnclick="Save();">
     	<input type="button" value=" 返回 " οnclick="Back();">			
      </div></td>
    </tr>
  </table>
</html:form>
</center>
</body>
</html>
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值