'WEB'에 해당되는 글 66건
- 2008.12.13 [WEB] HTML 화면보기 기능이 있는 게시판
2008. 12. 13. 13:22
[WEB] HTML 화면보기 기능이 있는 게시판
2008. 12. 13. 13:22 in WEB
<html>
<head>
</head>
<body class="body" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<script language="javascript">
//초기화
function init() {
TextEditor.document.onmousedown = new Function("TextEditorEvent()");
iText = TextEditor;
initEditor();
iText.document.designMode = "On";
TextEditView.style.display="inline";
bLoad = true;
}
//초기화면 스타일 설정
function initEditor() {
var bHeader = "<link rel=\"stylesheet\" href=\"/css/okjsp.css\" type=\"text/css\">";
iText.document.open();
iText.document.write(bHeader);
iText.document.write(f1.content.value);
iText.document.close();
iText.document.body.style.fontSize = "9pt";
iText.document.body.style.fontFamily = "Verdana,Dotumche";
}
function changeToSource(){
if(f1.html.checked) {
f1.TextView.style.display = 'none';
TextEditView.style.display = 'inline';
TextEditor.document.body.innerHTML = f1.TextView.value;
} else {
TextEditView.style.display = 'none';
f1.TextView.style.display = 'inline';
f1.TextView.value = TextEditor.document.body.innerHTML;
}
}
function TextEditorEvent(){
if (TextEditor.event.button==2){
var oSource = TextEditor.event.srcElement ;
if (!oSource.isTextEdit)
oSource = TextEditor.event.srcElement.parentTextEdit;
var strValue = TextEditor.event.srcElement.tagName; //선택된 부분의 태그 종류
if ((strValue == "IMG" || strValue == "HR") && oSource != null) {
var oTextRange = oSource.createTextRange();
}
var selectedRange = TextEditor.document.selection.createRange();
var edValue = selectedRange.htmlText;
var strX = TextEditor.event.x;
var strY = TextEditor.event.y+180;
if (strValue == "IMG")
strH = "180px";
else if (strValue == "HR" || strValue == "TABLE")
strH = "135px";
else
strH = "340px";
var strParam = "dialogLeft:" + strX + ";dialogTop:" + strY + ";"
strParam = strParam + "center:no;dialogWidth:150px; dialogHeight:" + strH + ";status:0;scroll:0; help:0;unadorned:yes;"
}
}
//action event
function check(){
if(f1.html.checked) {
document.f1.content.value = TextEditor.document.body.innerHTML;
} else {
document.f1.content.value = f1.TextView.value;
}
if (document.f1.content.value.length==0 || document.f1.content.value=="<P> </P>") {
alert("no content");
return false;
}
// filtering
banWord = filterWord(document.f1.content.value);
if (banWord.length > 0) {
alert(banWord +' word can\'t be used.');
return false;
}
if (document.f1.subject.value=="" ) {
alert("no subject");
document.f1.subject.focus();
return false;
}
if (document.f1.writer.value=="" ) {
alert("no writer");
document.f1.writer.focus();
return false;
}
if (document.f1.password.value=="" ) {
alert("no password");
document.f1.password.focus();
return false;
}
f1.send.disabled=true;
return true;
}
function submit_form1(){
if(form1.html.checked) {
document.form1.mi_cont.value = TextEditor.document.body.innerHTML;
} else {
document.form1.mi_cont.value = form1.TextView.value;
}
if (document.form1.mi_cont.value.length==0 || document.form1.mi_cont.value=="<P> </P>") {
alert("내용을 입력해주십시오.");
return;
}
form.submit();
}
</script>
<table width="882" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width='120' valign='top'>
<form name="f1" method="post" ENCTYPE="multipart/form-data" onSubmit="return check()">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>제목</td>
<td colspan="3">
<input type="checkbox" name="html" value="2" checked onClick="changeToSource()"> 웹보기
</td>
</tr>
<tr>
<td valign="top" height="163">내용</td>
<td colspan="3" valign="top" height="163">
<textarea style='display:none' name=content></textarea>
<font id='TextEditView' style='width:480px; height:310px;display: inline;'>
<iframe id='TextEditor' marginwidth='2' marginheight='1' style='width:480px; height:310px;'>
</iframe>
</font>
<textarea id='TextView' style='border:1 solid; border-color:#D4D4D4; width:480px; height:310px;display: none;'></textarea>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<input type="submit" value="보내기" name="send" style="width:50">
</body>
<script>
init();
</script>
</html>