글쓰기에 에디터 달기 첨부파일 활용
<SCRIPT language=javascript>
var IEVer = navigator.appVersion.match(/MSIE \d+.\d+/)[0].split(" ")[1];
var docStyle = "<STYLE>P {margin-top:2px;margin-bottom:2px;}</STYLE>";
function setForeColor() {
var foreColor = showModalDialog("Editer/select_color.html","","font-family:굴림; font-size:10; dialogWidth: 30em; dialogHeight: 33em");
if(foreColor != null) {
DHTMLEditor.document.execCommand("forecolor", "", foreColor);
DHTMLEditor.focus();
}
}
function setBackColor() {
var backColor = showModalDialog("Editer/select_color.html","","font-family:굴림; font-size:10; dialogWidth: 30em; dialogHeight: 33em");
if(backColor != null) {
DHTMLEditor.document.execCommand("backcolor", "", backColor);
DHTMLEditor.focus();
}
}
function setImage() {
var imageUrl = showModalDialog("Editer/select_image.html","","font-family:굴림; font-size:10; dialogWidth: 40em; dialogHeight: 20em");
if(imageUrl != null) {
DHTMLEditor.document.writeln(imageUrl);
DHTMLEditor.focus();
}
}
function setTable() {
var tablepro = showModalDialog("Editer/select_table.html","","font-family:굴림; font-size:10; dialogWidth: 35em; dialogHeight: 20em");
if(tablepro != null) {
DHTMLEditor.document.writeln(tablepro);
DHTMLEditor.focus();
}
}
function hyperLink() {
DHTMLEditor.document.execCommand("CreateLink", 1, "");
DHTMLEditor.focus();
}
function getDHTMLEditorContents() {
htmlHead = "<HEAD>\n"+docStyle+"\n</HEAD>\n";
htmlBody = DHTMLEditor.document.all.tags("BODY")[0].outerHTML+"\n";
htmlContent = "<HTML>\n"+htmlHead+htmlBody+"</HTML>";
return(htmlContent);
}
function initDHTMLEditor() {
DHTMLEditor.document.writeln("<HTML><HEAD><TITLE></TITLE>"+docStyle+"</HEAD><BODY></BODY></HTML>");
DHTMLEditor.document.body.style.fontSize = "10pt";
DHTMLEditor.document.body.style.fontFamily = "굴림";
<% if edit = "ok" then
contents = Replace(contents,chr(13) & chr(10)," ")
%>
DHTMLEditor.document.body.innerHTML = '<%=contents%>'
//DefaultBody.innerHTML;
<% end if %>
}
</SCRIPT>
<SCRIPT EVENT="DocumentComplete()" FOR="DHTMLEditCtrl">
DHTMLEditor = document.myform.DHTMLEditCtrl.DOM.parentWindow;
setTimeout("initDHTMLEditor()", 0);
DHTMLEditor.focus();
</SCRIPT>
<!--
function send()
{
if (document.myform.subject.value=='') {alert("제목를 입력 해줘요! ");document.myform.subject.focus();return false;}
//if (document.myform.contents.value!='') {document.myform.contents.value = getDHTMLEditorContents();}
document.myform.contents.value = getDHTMLEditorContents();
//else if (document.myform.contents.value!=''){document.myform.contents.value = getDHTMLEditorContents();}
if (document.myform.file.value==""){document.myform.submit();}
else{self.name="origin";window.open("upload.asp","upload","toolbar=no,menubar=no,resizable=no,scrollbars=no,width=350,height=200,left=300,top=250"); document.myform.encoding ="multipart/form-data";document.myform.action = "upload.asp";document.myform.target = "upload";document.myform.submit();}
}
//-->
</script>
<form name="myform" method="post" Action="write_ok.asp">
<TABLE CELLPADDING=0 CELLSPACING=0 WIDTH=485 border=0 class=list>
<input type=hidden name=contents value=''>
<TBODY bgcolor=EFEFEF>
<tr><TD NOWRAP>
<SELECT NAME="fontName" style="width:80; font-size:9pt" onChange="DHTMLEditor.document.execCommand('fontname', '', this[this.selectedIndex].value); DHTMLEditor.focus()">
<OPTION VALUE="굴림" selected>굴림</OPTION>
<OPTION VALUE="굴림체">굴림체</OPTION>
<OPTION VALUE="궁서">궁서</OPTION>
<OPTION VALUE="궁서체">궁서체</OPTION>
<OPTION VALUE="돋움">돋움</OPTION>
<OPTION VALUE="돋움체">돋움체</OPTION>
<OPTION VALUE="바탕">바탕</OPTION>
<OPTION VALUE="바탕체">바탕체</OPTION>
<OPTION VALUE="Arial">Arial</OPTION>
<OPTION VALUE="Tahoma">Tahoma</OPTION>
<OPTION VALUE="Courier New">Courier..</OPTION>
<OPTION VALUE="Times New Roman">Times..</OPTION>
<OPTION VALUE="Wingdings">Wingdings</OPTION>
</SELECT>
<SELECT NAME="fontSize" style="width:40; font-size:9pt" onChange="DHTMLEditor.document.execCommand('fontsize', '', this[this.selectedIndex].value); DHTMLEditor.focus()">
<OPTION VALUE="1">1</OPTION>
<OPTION VALUE="2" selected>2</OPTION>
<OPTION VALUE="3">3</OPTION>
<OPTION VALUE="4">4</OPTION>
<OPTION VALUE="5">5</OPTION>
<OPTION VALUE="6">6</OPTION>
<OPTION VALUE="7">7</OPTION>
</SELECT>
<%
' <SELECT NAME="lineHeight" onChange="DHTMLEditor.document.body.style.lineHeight=this[this.selectedIndex].value; DHTMLEditor.focus()">
' <OPTION VALUE="">행간
' <OPTION VALUE="100%" SELECTED>100%</OPTION>
' <OPTION VALUE="110%">110%</OPTION>
' <OPTION VALUE="120%">120%</OPTION>
' <OPTION VALUE="130%">130%</OPTION>
' <OPTION VALUE="140%">140%</OPTION>
' <OPTION VALUE="150%">150%</OPTION>
' <OPTION VALUE="160%">160%</OPTION>
' <OPTION VALUE="170%">170%</OPTION>
' <OPTION VALUE="180%">180%</OPTION>
' <OPTION VALUE="190%">190%</OPTION>
' <OPTION VALUE="200%">200%</OPTION>
' </SELECT> </td><td>
'
%>
<script LANGUAGE="JavaScript">
var viewToolBar = new Array( 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0,0,0,0,0,0,0,1);
var buttons = new Array( 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23);
var action = new Array( "bold", "italic", "underline", "forecolor", "backcolor", "backgroundcolor", "justifyleft", "justifycenter", "justifyright", "insertorderedlist", "insertunorderedlist", "outdent", "indent", "createLink", "image", "new", "open", "save", "cut", "copy", "paste", "", "", "", "", "", "", "", "", "table");
var tooltip = new Array( "굵게", "기울임꼴", "밑줄", "글자색", "글바탕색", "바탕색", "왼쪽 맞춤", "가운데 맞춤","오른쪽 맞춤", "번호매기기", "글머리기호", "내어쓰기","들여쓰기", "링크만들기", "이미지", "새로작성", "열기", "저장", "자르기","복사", "붙이기", "취소", "다시", "", "", "", "", "", "", "테이블");
var left = 0;
var s = "";
for(i = 0, j = 0; i < buttons.length; i++) {
if(viewToolBar[i] == 1) {
s += "<SPAN STYLE='position:relative;height:26;width:" + buttons[i] + "'><SPAN STYLE='position:absolute;margin:0px;padding:0;height:26;top:0;left:0;width:" + (buttons[i])+ ";clip:rect(0 "+buttons[i]+" 25 "+0+");overflow:hidden'><IMG BORDER=0 SRC='Editer/htmleditor.gif' STYLE='position:absolute;top:0;left:-" + left + "' WIDTH=874 HEIGHT=50";
if(buttons[i] != 0) {
s += " onMouseOver='this.style.top=-25' onMouseOut='this.style.top=0' onClick=\"";
if(action[i]=="createLink") {
s += "hyperLink(); this.style.top=0\" ";
}
else if(action[i]=="forecolor") {
s += "setForeColor(); this.style.top=0\" ";
}
else if(action[i]=="backcolor") {
s += "setBackColor(); this.style.top=0\" ";
}
else if(action[i]=="image") {
s += "setImage(); this.style.top=0\" ";
}
else if(action[i]=="table") {
s += "setTable(); this.style.top=0\" ";
}
else {
s += "DHTMLEditor.document.execCommand('" + action[i] + "'); DHTMLEditor.focus(); this.style.top=0\" ";
}
s += "title=\"" + tooltip[i] + "\""
}
s += "></SPAN></SPAN>";
}
left += buttons[i];
}
document.writeln(s);
</script>
</TD></TR>
</TBODY>
</TABLE>
</td>
</tr>
<tr>
<td colspan="2" align=center >
<OBJECT NAME="DHTMLEditCtrl" ID="DHTMLEditCtrl" TABINDEX=4 STYLE="WIDTH: 550; HEIGHT: 250;" CLASSID="clsid:2D360201-FFF5-11d1-8D03-00A0C959BC0A" VIEWASTEXT>
<PARAM NAME="scrollbars" VALUE="true">
</OBJECT>
</td></tr></table>
'마루아라는 개발쟁이 > ASP' 카테고리의 다른 글
DHTML 게시판 웹에디터 만들다 만놈 (0) | 2022.12.07 |
---|---|
세션을 DB로 관리하기 + 쪽지 확인하기 (0) | 2022.12.07 |
같은 아이디로 동시접속 하는걸 방지하는 방법 (0) | 2022.12.06 |
강제종료시 로그아웃 및 중복로그인 체크 (0) | 2022.12.06 |
중복 로그인 처리 방법 (0) | 2022.12.06 |