I/T/JavaScript2009. 9. 24. 10:31
Escape와 Unescape 사용법입니다.
한글 값을 넘겨줄 때 사용되어지죠.
나중에 실제 사용 코드를 올려보겠습니다.

<?xml version="1.0" encoding="EUC-KR" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR" />
		<title>String function example</title>
		
		<script type="text/javascript">
			function changeEscape() {
				var f = document.myForm;
				var beforeValue = "";
				var afterValue = "";
								
				beforeValue = f.stringValue.value;
				afterValue = escape(beforeValue);
				f.asciiValue.value = afterValue;
			}
			
			function changeUnescape() {
				var f = document.myForm;
				var beforeValue = "";
				var afterValue = "";
								
				beforeValue = f.asciiValue.value;
				afterValue = unescape(beforeValue);
				f.stringValue.value = afterValue;
			}
		</script>
	</head>
	<body>
		<form name="myForm">
			<textarea name="stringValue" rows="2" cols="60"></textarea>
			<input type="button" value="String to ascii" onclick="changeEscape();" /><br />
			<textarea name="asciiValue" rows="2" cols="60"></textarea>
			<input type="button" value="Ascii to String" onclick="changeUnescape();" /><br />
		</form>
	</body>
</html>

'I/T > JavaScript' 카테고리의 다른 글

JavaScript Input(Radio) Element  (0) 2010.06.03
Javascript Array 사용법  (0) 2009.09.24
Javascript switch문 사용법  (0) 2009.06.16
Javascript if문 사용법  (0) 2009.06.16
Javascript for문 사용법  (0) 2009.06.16
Posted by 황타