어렵다 어려워... 자바스크립트를 이용한 방법(IE, 크롬 테스트 완료)
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<%@ page import="net.fckeditor.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Maven onjTel Test</title>
<script type="text/javascript" src="/SpringWeb/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
function FCKeditor_OnComplete(editorInstance) {
window.status = editorInstance.Description;
}
function check_form(){
//id체크
var myTitle = document.forms[0].elements["title"].value;
var mycontents = document.forms[0].elements["contents"].value;
if ($.trim(myTitle).length == 0) {
alert("제목입력!");
return false;
}
/*
if ($.trim(mycontents).length == 0) {
alert("내용입력!");
return false;
}
*/
/*
if (document.getElementById('contents').innerHTML == '') {
alert('required field');
return false;
}*/
var EditorInstance = FCKeditorAPI.GetInstance('contents') ;
//if(EditorInstance.EditorDocument.body.innerText.length<=0)
if (EditorInstance.GetXHTML()=="")
{
alert("This firld is mandatory");
EditorInstance.EditorDocument.body.focus();
return false;
}
return true;
}
</script>
</head>
<body>
<h1> 글쓰기</h1>
<%
FCKeditor fckEditor = new FCKeditor(request, "contents");
%>
<form action="/SpringWeb/board.html?onj=write" method="post"
onsubmit="return check_form()">
<input type="text" name="title" id="title" size="50" /> <br/>
<%
//fckEditor.setValue("초기값");
out.println(fckEditor);
%>
<br />
<input type="submit" value="전송" />
</form>
</body>
</html>
'ajax' 카테고리의 다른 글
| fckeditor 설정 (0) | 2013.01.21 |
|---|---|
| ckeditor설정 (0) | 2013.01.17 |
| jquery plugin 작성 #1 (0) | 2013.01.14 |
| jquery tablesorter (0) | 2013.01.13 |
| jquery ui resize (0) | 2013.01.13 |