본문 바로가기
편하게 잘쓰기/웹프로그래밍

웹접근성 향상을 위한 화면 확대/축소 스크립트

by 그린아띠 2011. 11. 21.

<table>

<tr>

  <td>

<ul>

<li><input class="textplus" type="button" onclick='javascript:zoomOut();'   value="+ 확대" /></li>

<li><input class="textplus" type="button" onclick='javascript:zoomReset();' value="* 기본" /></li>

<li><input class="textplus" type="button" onclick='javascript:zoomIn();'    value="- 축소" /></li>

<li style="padding: 0;">&nbsp;</li>

</ul>

  </td>

</tr>

</table>

<!--

//2009-08-07 오전 11:55:08 오정철

// 웹접근성 향상 관련 화면 축소 확대 기능 추가

-->

<script type="text/javascript"> 

var nowZoom = 100;

function zoomIn() {

nowZoom = nowZoom - 10;

if(nowZoom <= 70) nowZoom = 70;

zooms();

}


function zoomOut() {

nowZoom = nowZoom + 20;

if(nowZoom >= 500) nowZoom = 500;

zooms();

}

function zoomReset(){

nowZoom = 100; 

zooms();

}

function zooms(){

document.body.style.zoom = nowZoom + '%';

if(nowZoom==70){

alert ("30%축소 되었습니다. 더 이상 축소할 수 없습니다.");

}

if(nowZoom==500){

alert ("500%확대 되었습니다. 더 이상 확대할 수 없습니다.");

}

}

</script> 


'편하게 잘쓰기 > 웹프로그래밍' 카테고리의 다른 글

PHP로 PDF생성 클래스 두가지  (0) 2011.12.30