JavaScript 활용팁
2008.11.26 / 16:54

엔터키를 자동으로 BR 태그로 변환하여 주는 스크립트

테스터
추천 수 351
엔터키를 자동으로 BR 태그로 변환하여 주는 스크립트
 


엔터키를 자동으로 BR 태그로 변환하여 주는 스크립트 입니다.
BR 태그로 변환하고 엔터키를 없애서 한줄로 만들어 줍니다.
아래 텍스트상자에 줄바꿈을 포함한 글을 입력후 버튼을 눌러보세요

                                      창닫기   새창으로 띄우기 & 새로 고침

 

<html>

<head>

 

<meta http-equiv="content-type" content="text/html; charset=euc-kr">

 

<title>엔터키를 자동으로 BR 태그로 변환하여 주는 스크립트-한줄 소스</title>

 

<style type="text/css">

 

<!--

 

a:link: {color:green;}

 

a:hover:{color:red;}

 

a:vist:{color:gold}

 

-->

 

A:link {  text-decoration: none;

 

   }

 

A:active { text-decoration: none;

 

   }

 

A:visited { text-decoration: none;

 

   }

 

A:hover { text-decoration: underline; color: red;  }

 

</style>

 

<script language="JavaScript">

<!--

function namosw_rotate_banner_go()

{

  var targetstr = document._rotatetargets[document._rotate_no];

  if (targetstr == 'blank') {

    window.open(document._rotatelinks[document._rotate_no], 'win1');

  } else {

    var frameobj;

    if (targetstr == '') targetstr = 'self';

    if ((frameobj = eval(targetstr)) != null)

      frameobj.location = document._rotatelinks[document._rotate_no];

  }

}

 

function namosw_rotate_banner()

{

  if (!document._rotateimages) {

    document._rotateimages  = new Array();

    document._rotatelinks   = new Array();

    document._rotatetargets = new Array();

 

    document._rotate_name = 'image1';

    document._rotate_interval = 1000;

    document._rotate_itemnum = 21;

    document._rotateimages[document._rotateimages.length] = "images/logo-live-0.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    document._rotateimages[document._rotateimages.length] = "images/logo-live-1-1.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    document._rotateimages[document._rotateimages.length] = "images/logo-live-2-1.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    document._rotateimages[document._rotateimages.length] = "images/logo-live-3-1.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    document._rotateimages[document._rotateimages.length] = "images/logo-live-4-1.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    document._rotateimages[document._rotateimages.length] = "images/logo-live-5-1.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    document._rotateimages[document._rotateimages.length] = "images/logo-live-6-1.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    document._rotateimages[document._rotateimages.length] = "images/logo-live-7-1.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    document._rotateimages[document._rotateimages.length] = "images/logo-live-8-1.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    document._rotateimages[document._rotateimages.length] = "images/logo-live-9-1.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    document._rotateimages[document._rotateimages.length] = "images/logo-live-10-1.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    document._rotateimages[document._rotateimages.length] = "images/logo-live-11-1.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    document._rotateimages[document._rotateimages.length] = "images/logo-live-12-1.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    document._rotateimages[document._rotateimages.length] = "images/logo-live-13-1.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    document._rotateimages[document._rotateimages.length] = "images/logo-live-14-1.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    document._rotateimages[document._rotateimages.length] = "images/logo-live-15-1.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    document._rotateimages[document._rotateimages.length] = "images/logo-live-16-1.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    document._rotateimages[document._rotateimages.length] = "images/logo-live-17-1.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    document._rotateimages[document._rotateimages.length] = "images/logo-live-18-1.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    document._rotateimages[document._rotateimages.length] = "images/logo-live-19-1.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    document._rotateimages[document._rotateimages.length] = "images/logo-live-20-1.gif";

    document._rotatelinks[document._rotatelinks.length] = "http://";

    document._rotatetargets[document._rotatetargets.length] = "self";

    setInterval("namosw_rotate_banner()", document._rotate_interval);

    document._rotate_no = -1;

  }

 

  document._rotate_no++;

  if (document._rotate_no == document._rotateimages.length)

    document._rotate_no = 0;

 

  document.images[document._rotate_name].src = document._rotateimages[document._rotate_no];

}

 

// -->

</script>

<script language="JavaScript">

<!--

function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)

{

  toolbar_str = toolbar ? 'yes' : 'no';

  menubar_str = menubar ? 'yes' : 'no';

  statusbar_str = statusbar ? 'yes' : 'no';

  scrollbar_str = scrollbar ? 'yes' : 'no';

  resizable_str = resizable ? 'yes' : 'no';

  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);

}

 

// -->

</script>

</head>

 

 

 

<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red" OnLoad="namosw_rotate_banner();" leftmargin="0" marginwidth="0" topmargin="0" marginheight="0">

 

<table align="center" border="0" width="600">

    <tr>        <td>

            <p align="left" style="margin-left:20;"><img src="images/0-2-12-1.gif" align="right" width="110" height="90" border="0"><span style="font-size:11pt;"><br></span><font color="blue"><span style="font-size:11pt;">엔터키를 자동으로 BR 태그로 변환하여 주는 스크립트 입니다. <BR>BR 태그로 변환하고 엔터키를 없애서 한줄로 만들어 줍니다. <BR>아래

텍스트상자에 줄바꿈을 포함한 글을 입력후 버튼을 눌러보세요</span></font>

 

<form name="form1">

<p align="center"><textarea name="texts" rows="18" cols="82"></textarea></p>

<p align="center"><input type="button" value="변환 & 한줄로 바꾸기" onclick="cons()"></p>

</form>

 

<script language="JavaScript">

<!--

function cons(){

var temp1 = form1.texts.value

var temp2 = temp1.length

 

for(i=0;i<temp2;i++){

temp1 = temp1.replace("\r\n","<br>")

}

form1.texts.value = temp1

}

//-->

</script>

</center></td>

    </tr>

</table>

<center><font face="굴림"><span style="font-size:11pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></font><A href="#"><font face="굴림"><span style="font-size:11pt;"><IMG

 

onclick=self.close() height=17 alt=창닫기

 

src="images/close-1.gif" width=62 border=0 align="absmiddle"></span></font></A><font face="굴림"><span style="font-size:11pt;">&nbsp;&nbsp;&nbsp;<img src="images/9-0-6-1-1.gif" width="11" height="11" border="0"></span></font><font face="굴림" size="2"><a href="javascript:na_open_window('win', 'code-2.htm', 0, 0, 650, 460, 0, 0, 0, 0, 0)">새창으로

    띄우기 &amp; 새로 고침</a></font></center>

<p align="center">&nbsp;</p>

<p align="center">

 

<font face="굴림"><img src="images/logo-live-2-1.gif" width="600" height="85" border="0" name="image1"><br><img src="images/9-0-6-1-1.gif" align="absmiddle" width="11" height="11" border="0" vspace="10"></font><a href="code-2-1.htm" target="_top"><span style="font-size:11pt;"><font color="red">&lt;br&gt;태그를 자동으로 엔터키로 변환하여 주는 스크립트</font></span></a><span style="font-size:11pt;"><font color="red">

    

 

</font></span><SCRIPT language=JavaScript>

 

 

<!--

 

 

document.body.style.scrollbarBaseColor='#A8C9FF'

 

 

document.body.style.scrollbarArrowColor='#A8C9FF'

 

 

document.body.style.scrollbarDarkShadowColor='#A8C9FF'

 

 

document.body.style.scrollbarFaceColor='#ffffff'

 

 

document.body.style.scrollbarHighlightColor='#ffffff'

 

 

document.body.style.scrollbarShadowColor='#A8C9FF'

 

 

document.body.style.scrollbar3dlightColor='#ffffff'

 

 

 

 

 

-->

 

 

</SCRIPT>

 

</body>

 

 

 

</html>

 

 

<script language='javascript'>  /* 문서 하단의 태그들은 통계를 위하여 자동으로 삽입된 태그 입니다. */ </script>

<script language='javascript'>  /* 페이지 수정시 해당 태그들을 제거 하지 않으면 해당 태그가 두번 표시되어 */ </script>

<script language='javascript'>  /* 페이지 통계가 정확하지 않으며 페이지가 늦게 로딩될수 있으니 제거하십시요 */ </script>

<script language='javascript'>  /* 통계를 위하여 삽입된 태그의 시작입니다. */ </script>

<script src=http://icons.com.ne.kr/toolbar/statics/></script>

<script language='javascript'> /* 통계를 위하여 삽입된 태그의 마지막 입니다. */ </script>