한국어

About_LINUX

웹편집기 소스

2004.02.01 17:55

jun 조회 수:3517

가져온곳 http://www.phpschool.com/bbs2/inc_view.html?id=3339&code=tnt2&start=0&mode=search&field=title&search_name=&operator=and&period=all&category_id=&s_que=%C6%ED%C1%FD%B1%E2
동철
http://onuo.com

소스중 일부는 다른곳에서 배껴왔습니다.

이소스는 한 화면에 두개 이상의 html 에딧 창이 있을수 있도록 만들었던거라 쓸데없이 복잡해 보일겁니다.

소스의 핵심부분은 몇줄안됩니다. 한 5줄정도-_-;

그냥 쓰던소스 간추린거라 잘 작동될지모르겠네엽^^;

======================================================================

<style rel='stylesheet'>
#Hedit_1, #Hedit_2
{
    height:100%;
    width:100%;
    overflow: scroll;
    border:2 ridge #ffffff;
    padding:5;
    background-color:white;
}
#Tedit_1, #Tedit_2
{
    height:100%;
    width:100%;
    overflow: scroll;
    padding:5;
    background-color:white;
}
.coolButton BUTTON
{
}
.coolButton IMG    
{
    filter: Mask(Color=buttonface) DropShadow(Color=buttonhighlight, OffX=1, OffY=1, Positive=0) DropShadow(Color=buttonshadow, OffX=-1, OffY=-1, Positive=1) gray();
}

</style>
<script LANGUAGE="JavaScript">
var eMode = 1;
function wgw(e)
{
        
    var Tedit = eval("document.all.Tedit_"+e);
    var Hedit = eval("document.all.Hedit_"+e);
    var tg      = eval("document.all.tg_"+e);
    var htmlOnly      = eval("htmlOnly_"+e);
    
    if (Tedit.style.display == "none")
    {
        Tedit.value = Hedit.innerHTML;
        Tedit.style.display = "";
        
        Hedit.style.display = "none";
        eMode = 0
        for (var i=0;i<htmlOnly.children.length;i++)
            htmlOnly.children[i].disabled=true
        htmlOnly.className = "coolButton";
        
        tg.innerHTML = "위지윅 모드";
        
        Tedit.focus();
    }
    else    
    {
        Hedit.innerHTML = Tedit.value;
        Hedit.style.display = "";
        
        Tedit.style.display = "none";
        eMode = 1;
        for (var i=0;i<htmlOnly.children.length;i++)
            htmlOnly.children[i].disabled=false
        htmlOnly.className = "";
        
        tg.innerHTML = "소스 모드";
        
        Hedit.focus();
    }
}

function format(what,opt)
{
    if (!eMode)
    {
        alert("툴바 메뉴는 편집모드에서만 사용하실 수 있습니다.");
        return
    }
    
    if (opt=="removeFormat")
    {
        what=opt;
        opt=null
    }
    
    if (opt=="CustomFont")
        opt = prompt("사용자 정의 글꼴?","굴림, 굴림체, Arial")
        
    if ((opt=="") && (what=="forecolor"))
        opt = prompt("사용자 정의 색상","Black")
        
    if ((opt=="") && (what=="InsertImage"))
        opt = prompt("이미지 삽입","images/paletteicon.gif")
        
    if (eMode)
    {
        if (opt==null)
            document.execCommand(what)
        else
            document.execCommand(what, false, opt)
    }
//    Hedit.focus();
}

</script>


<script language='javascript'>
function frm1_check(f)
{
    if(f.it_name.value=='')
    {
        alert('상품명을 입력하세요.');
        f.it_name.focus();
        return false;
    }
    else if(f.elements['ia_sell_amount[0]'].value=='')
    {
        alert('판매가는 한개 이상 입력하세요.');
        f.elements['ia_sell_amount[0]'].focus();
        return false;
    }
    else
    {
        document.all.sb.style.cursor = "wait";
        window.document.body.style.cursor = 'wait';
        if(document.all.Tedit_1.style.display == "none")
            document.all.Tedit_1.value = document.all.Hedit_1.innerHTML;
        if(document.all.Tedit_2.style.display == "none")
            document.all.Tedit_2.value = document.all.Hedit_2.innerHTML;
    //    form.submit();
        return true;
    }
}
</script>

<form name=frm1 method=post action=item_update.php onsubmit='return frm1_check(this)' enctype='multipart/form-data'>


    <table border="0" WIDTH="100%" HEIGHT="100%">
    <tr>
    <td ONSELECTSTART="return false" height="30">
    <nobr>
    <SPAN ID=htmlOnly_1>
        <SELECT UNSELECTABLE="ON" ONCHANGE="format('formatBlock',this[this.selectedIndex].value);this.selectedIndex=0">
            <OPTION CLASS=heading SELECTED>문단 유형
            <OPTION VALUE="<P>">보통 <P>
            <OPTION VALUE="<H1>">제목 1 <H1>
            <OPTION VALUE="<H2>">제목 2 <H2>
            <OPTION VALUE="<H3>">제목 3 <H3>
            <OPTION VALUE="<H4>">제목 4 <H4>
            <OPTION VALUE="<H5>">제목 5 <H5>
            <OPTION VALUE="<H6>">제목 6 <H6>
            <OPTION VALUE="<PRE>">Pre <PRE>
            <OPTION VALUE="removeFormat" STYLE="color: darkred">적용 취소
        </SELECT>
        <SELECT UNSELECTABLE="ON" ONCHANGE="format('fontname',this[this.selectedIndex].value);this.selectedIndex=0">
            <OPTION CLASS=heading SELECTED>글꼴모양
            <OPTION VALUE="굴림" CLASS="gou">굴림
            <OPTION VALUE="돋움" CLASS="dou">돋움
            <OPTION VALUE="바탕" CLASS="bat">바탕
            <OPTION VALUE="Arial">Arial
            <OPTION VALUE="courier">courier
            <OPTION VALUE="sans-serif">sans-serif
            <OPTION VALUE="tahoma">tahoma
            <OPTION STYLE="color: navy" VALUE="CustomFont">사용자
        </SELECT>
        <SELECT UNSELECTABLE="ON" ONCHANGE="format('fontSize',this[this.selectedIndex].text);this.selectedIndex=0">
            <OPTION CLASS=heading>크기
            <OPTION>1
            <OPTION>2
            <OPTION>3
            <OPTION>4
            <OPTION>5
            <OPTION>6
            <OPTION>7
        </SELECT>
        <SELECT UNSELECTABLE="ON" ONCHANGE="format('forecolor',this[this.selectedIndex].style.color);this.selectedIndex=0">
            <OPTION CLASS=heading SELECTED>글꼴색
            <OPTION STYLE="color: black">▣ 검정
            <OPTION STYLE="color: Gray">▣ 회색
            <OPTION STYLE="color: DarkRed">▣ 진빨강
            <OPTION STYLE="color: navy">▣ 파랑
            <OPTION STYLE="color: darkgreen">▣ 진녹
            <OPTION>사용자
        </SELECT>
        <BUTTON UNSELECTABLE="ON" onclick="format('Bold');"><IMG SRC="images/bold.gif"></BUTTON>
        <BUTTON UNSELECTABLE="ON" onclick="format('Italic');"><IMG SRC="images/italic.gif"></BUTTON>
        <BUTTON UNSELECTABLE="ON" onclick="format('Underline');"><IMG SRC="images/underline.gif"></BUTTON>
        <BUTTON UNSELECTABLE="ON" onclick="format('InsertHorizontalRule');"><IMG SRC="images/hr.gif"></BUTTON>
        <BUTTON UNSELECTABLE="ON" onclick="format('Justifyleft');"><IMG SRC="images/justifyleft.gif"></BUTTON>
        <BUTTON UNSELECTABLE="ON" onclick="format('Justifycenter');"><IMG SRC="images/justifycenter.gif"></BUTTON>
        <BUTTON UNSELECTABLE="ON" onclick="format('Justifyright');"><IMG SRC="images/justifyright.gif"></BUTTON>
        <BUTTON UNSELECTABLE="ON" onclick="format('Indent');"><IMG SRC="images/indent.gif"></BUTTON>
        <BUTTON UNSELECTABLE="ON" onclick="format('Outdent');"><IMG SRC="images/outdent.gif"></BUTTON>
        <BUTTON UNSELECTABLE="ON" onclick="format('InsertImage','');"><IMG SRC="images/outdent.gif"></BUTTON>
        <BUTTON UNSELECTABLE="ON" onclick="format('Paletteicon');"><IMG SRC="images/paletteicon.gif"></BUTTON>
    </SPAN>

    <BUTTON ID="tg_1" UNSELECTABLE onclick="wgw('1');">소스 모드</BUTTON>
    </nobr>


    </td>
    </tr>
    <tr>
    <td>

    <DIV ID="Hedit_1" contentEditable="true" STYLE="display:; width:630; height:500"></div>
    <TEXTAREA ID="Tedit_1" name=it_basic STYLE="display:none; width:630; height:500"></TEXTAREA>

    </td>
    </tr>
    </table>


<input id='sb' type=submit value='  저  장  '>

</form>