Files
ncue_business/unicode.html
dsyoon f99bb2ba6b init
2025-12-27 13:09:05 +09:00

96 lines
3.4 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style media="screen">
body{
background-color: #f5f5f5;
}
#unicode {
width:100%;
height:100%;
color: green;
}
.in-line{
width:1000px;
height:200px;
}
input{
margin:0;
}
input[type="text"]{
width:500px;
height:25px;
line-height:25px;
border:none;
font-size:1em;
padding-left: 5px;
font-style: oblique;
display:inline;
outline:none;
box-sizing: border-box;
color:black;
}
input[type=button]{
width: 50px;
height:25px;
background-color: lightgray;
border:none;
background-color: #ABABAB;
font-size:1em;
color:#042AaC;
outline:none;
display:inline;
margin-left: -10px;
box-sizing: border-box;
}
input[type=button]:hover{
background-color: lightgray;
}
</style>
<script type="text/javascript">
function trans(){
document.getElementById("hangul").value = '유니코드';
var str = document.getElementById("hangul").value;
document.getElementById("unicode").innerHTML = replaceAll(escape(str),"%","\\");
}
function detrans(){
var str = document.getElementById("unicode2").value;
document.getElementById("hangul2").innerHTML = unescape(replaceAll(str,"\\","%"));
}
function replaceAll(strTemp, strValue1, strValue2){
while(1){
if( strTemp.indexOf(strValue1) != -1 )
strTemp = strTemp.replace(strValue1, strValue2);
else
break;
}
return strTemp;
}
</script>
</head>
<body>
<div style="padding:50px;">
<div class="in-line">
한글 -> 유니코드
<input type="text" name="hangul" id="hangul" onkeyDown="JavaScript:if(event.keyCode==13){trans();}">
<input type="button" name="aa" value="변환" onclick="trans()">
<p>
<!--<input type="text" name="unicode" id="unicode" size="50">-->
<결과> <div id="unicode"></div>
</p>
</div>
<p></p>
<div class="in-line">
유니코드 -> 한글
<input type="text" name="unicode2" id="unicode2" onkeyDown="JavaScript:if(event.keyCode==13){detrans();}">
<input type="button" name="aa" value="변환" onclick="detrans()">
<p>
<결과> <div id="hangul2"></div>
</p>
</div>
</div>
</body>
</html>