<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> inc_dec</title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<script type="text/javascript">
<!--
function Encode()
{
var strRtn = escape(document.getElementById("taPlain").value);
strRtn = strRtn.replace(/%/g,"\\");
//alert(strRtn);
document.getElementById("taEncoded").innerHTML = strRtn;
}
function Decode()
{
var strDec = document.getElementById("taEncoded").value;
strDec = strDec.replace(/\\/g ,"%");
document.getElementById("taPlain").value = unescape(strDec);
}
//-->
</script>
<input type="button" value="인코딩" onclick="Encode()">
<input type="button" value="디코딩" onclick="Decode()">
<br>
<textarea id=taPlain rows=5 cols=70></textarea>
<br>
<textarea id=taEncoded rows=5 cols=70/></textarea>
</body>
</html>
[출처] http://www.okjsp.pe.kr/seq/155961
'JavaScript' 카테고리의 다른 글
[JavaScript] Debug JavaScript (0) | 2013.02.07 |
---|---|
[JavaScript] DOM 정보 (0) | 2013.01.09 |
[JavaScript] 선택일 기준으로 월~토 일자 가져오기 (0) | 2012.10.22 |
[JavaScript] 클로저(Closure) (0) | 2012.08.30 |
[JavaScript] 네이버 지도 API 연동 (0) | 2012.08.14 |