HTML ¼Ò½ºÀÔ·Â Àü¿ë textarea - ½ºÅ©·¦ ¹öÆ° Scrap º¹»ç ºÙ¿© ³Ö±â ±â´É
HTML ¼Ò½ºÀÔ·Â Àü¿ë textarea - ½ºÅ©·¦ ¹öÆ° Scrap º¹»ç ºÙ¿© ³Ö±â ±â´É
Multimedia DATA
Text DATA
¼Ò½º =================================================================
<html>
<head>
<style>
body,H1{
font-family: "Courier New", Courier, mono;
}
</style>
<script>
/*********************************************************************
* ¸¸µå´Ï : È£»ö»çÀÚ
* dr-no.co.kr / minin.hanweb.biz
* http://dr-no.co.kr/public/js_050426.html
HTML ¼Ò½ºÀÔ·Â Àü¿ë textarea
ºí·¯±×¿¡¼.. ±Û ¿Ã¸±¶§.. html ÆäÀÌÁö µå·¡±× Çؼ ºÙ¿© ³ÖÁö¿ä?
html ÀÇ ¿ä¼Ò¸¦ µå·¡±× Çؼ º¹»çÇϸé Ŭ¸³º¸µå¿¡´Â ¸ÖƼ¹Ìµð¾î µ¥ÀÌÅÍ°¡ µË´Ï´Ù.
ÀÌ°É ÀÏ¹Ý textarea ¿¡ ºÙ¿©³Ö±â Çϸé HTML ¼Ò½º´Â ºÙ¿©³Ö±â°¡ ¾ÈµÇÁö¿ä..
±×°É °¡´ÉÇÏ°Ô ÇÏ´Â ¿¹Á¦ÀÔ´Ï´Ù.
½ºÅ©¸³Æ®³»¿ëÀ» º¸½Ã¸é ¸¹Àº ºÎºÐµéÀÌ ÁøÇàÀÌ µÇ¾î ÀÖ°í °ø°³µÇ¾î ÀÖ½À´Ï´Ù.
È°¿ë Çϼż ÁÁÀº ¸ñÀûÀ¸·Î ¾²½Ã±æ ¹Ù¶ø´Ï´Ù.
*********************************************************************/
//window.clipboardData.setData('Text',"");
function init(){
HTMLEDITEFRAME.document.designMode="On";
setTimeout(f_int,100);
}
function f_int(){
inputHTMLz();
outputHTMLz();
}
function outputHTMLz(){
// A ű׿¡ TARGET ºÎ¿©
for ( var i = 0 ; i < HTMLEDITEFRAME.document.body.all.length ; i ++){
if (HTMLEDITEFRAME.document.body.all[i].tagName == "A")
HTMLEDITEFRAME.document.body.all[i].target="_blank";
}
outputHTMLVAL = HTMLEDITEFRAME.document.body.outerHTML;
document.all.HTMLCONTENTS.value = outputHTMLVAL.replace(/\<BODY\>|\<\/BODY\>/gi,"");
}
function inputHTMLz(){
HTMLEDITEFRAME.document.body.innerHTML = document.all.HTMLCONTENTS.value;
}
function HTMLSetData(){
Range2 = HTMLEDITEFRAME.document.body.createTextRange();
Range2.select();
HTMLEDITEFRAME.document.execCommand("copy");
}
function TXETSetData(){
Range2 = HTMLCONTENTS.createTextRange();
Range2.select();
HTMLCONTENTS.document.execCommand("copy");
}
var HTMLCONTENTS_FOCUS = false;
var tab_text = "||-yajava.com-||";
function ekeydown(e){
if(event.ctrlKey && event.keyCode == 86){
textobj = document.all.HTMLCONTENTS;
var sText = document.selection.createRange();
if (sText.text!=""){
document.execCommand("paste",true,tab_text);
}else{
textobj.value= textobj.value + tab_text;
}
textobj.value= textobj.value.replace(tab_text,multmedia_GetData());
event.keyCode = null;
event.cancelBubble = true;
event.returnValue = false;
textobj.focus();
return false;
}
return;
}
// ¸ÖƼ¹Ìµð¾î Ŭ¸³º¸µå -> ÅؽºÆ® °Ô½ÃÆÇ¿¡ ű׷Π»ý¼º
function multmedia_GetData(){
Range2 = HTMLEDITEFRAME.document.body.createTextRange();
Range2.select();
HTMLEDITEFRAME.document.execCommand("paste");
// A ű׿¡ TARGET ºÎ¿©
for ( var i = 0 ; i < HTMLEDITEFRAME.document.body.all.length ; i ++){
if (HTMLEDITEFRAME.document.body.all[i].tagName == "A")
HTMLEDITEFRAME.document.body.all[i].target="_blank";
}
outputHTMLVAL = HTMLEDITEFRAME.document.body.outerHTML;
return outputHTMLVAL.replace(/\<BODY\>|\<\/BODY\>/gi,"");
}
</script>
</head>
<body onload="init()">
<H1>Multimedia DATA</H1>
<iframe id="HTMLEDITEFRAME" name="HTMLEDITEFRAME" src="about:blank" style="height:200px; width:100%;border:1 solid C4CAD1" scrolling="auto" frameborder="0" ></iframe>
<button onclick="outputHTMLz();">Html ¼Ò½º·Î º¸³»±â¡é</button>
<button onclick="inputHTMLz();">µé¿©º¸³»±â ¡è</button>
<button onclick="HTMLSetData();">¸ÖƼ ³»¿ëº¹»ç</button>
<button onclick="TXETSetData();">ÅؽºÆ® ³»¿ëº¹»ç</button>
<H1>Text DATA</H1>
<textarea name="HTMLCONTENTS" id="HTMLCONTENTS" rows="10" style="height:200px; width:100%;border:1 solid C4CAD1" onkeydown="return ekeydown(event)" onfocus="HTMLCONTENTS_FOCUS=true;" onblur="HTMLCONTENTS_FOCUS=false;">
</textarea>
<textarea name="HIDDENCONTENTS" id="HIDDENCONTENTS" style="display:none;"></textarea>
</body>
</html>