- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <!-- 현재 작성하고 있는 파일은 UTF-8 DOS파일입니다.-->
- <html xmlns="http://www.w3.org/1999/xhtml" lang="ko">
- <head>
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
- </head>
- <body>
- <div id="ex_js_syntax">
- <script type="text/javascript" language="javascript">
- <!--
- function window_btoa(){
- /* 윈도우 base 64 encoded => window.btoa(); */
- var str_val = "nice to neet you";
- document.getElementById("window_btoa").innerHTML = window.btoa(str_val);
- }
- function window_atob(){
- /* 윈도우 base 64 decoded => window.atob(); */
- var str_val = "bmljZSB0byBuZWV0IHlvdQ==";
- document.getElementById("window_atob").innerHTML = window.atob(str_val);
- }
- //-->
- </script>
- <form name="input_type" id="input_type" method="post" >
- <!-- 예제 박스에선 안됨 => form태그안에 form태그있으면 지워짐~ㅠ.ㅠ -->
- 윈도우 => nice to neet you => base 64 엔코딩 <br />
- <p id="window_btoa" onclick="window_btoa();">window객체-메서드 btoa()[클릭]</p>
- 윈도우 => bmljZSB0byBuZWV0IHlvdQ== => base 64 디코딩 <br />
- <p id="window_atob" onclick="window_atob();">window객체-메서드 atob()[클릭]</p>
- </form>
- </div>
- </body>
- </html>
--------------------------------------------------------------------------------------------
위 소스 예제 보기
윈도우 base 64 encoded => window.btoa("변경문자열");
윈도우 base 64 decoded => window.atob("변경문자열");
window 속성 보기(접어두었습니다.)
출처 & 인용 - http://www.w3schools.com/
'javascript > window()객체' 카테고리의 다른 글
window객체 onload 로딩후 실행 (예제없음) (0) | 2014.02.10 |
---|---|
window객체 focus() 포커스 얻기 (0) | 2014.02.09 |
window객체 setTimeout() clearTimeout() 대기 후 한번만 실행 [실행, 해제] (0) | 2014.02.08 |
window객체 setInterval() clearInterval() 반복 실행 [실행, 해제] (0) | 2014.02.08 |
window객체 scrollBy() scrollTo() 스크롤 위치[상대적, 절대적] (0) | 2014.02.08 |