▣ 위의 LINK를 클릭하시면 샘플을 보실 수 있습니다.
(1) resize_script.html
<script>
function win() {
window.open("adma_script.html","","width=300,height=150,left=100,top=100")
}
</script>
<body>
<input type = "button" value = "press" onClick = "win()">
</body>
(2) adma_script.html
<script>
x = 100;
y = 100;
w = 300
h = 300
function win_move(tx, ty,tw,th) {
cx = Math.abs(tx-x)>1
cy = Math.abs(ty-y)>1
cw = Math.abs(tw-w)>1
ch = Math.abs(th-h)>1
if (cx || cy || cw || ch) {
x = x+(tx-x)*0.2;
y = y+(ty-y)*0.2;
w = w+(tw-w)*0.2;
h = h+(th-h)*0.2;
window.moveTo(x, y);
window.resizeTo(w, h);
} else {
clearInterval(id);
}
}
function auto(x,y,w,h) {
id = setInterval("win_move("+x+","+y+","+w+","+h+")", 10);
}
function resize() {
window.resizeBy(10,10)
}
</script>
<body>
X좌표,Y좌표,넓이,길이<br>
<input type = "button" value = "(100,300,400,200)으로 이동" onClick = "auto(100,300,400,200)">
<input type = "button" value = "(300,200,350,200)으로 이동" onClick = "auto(300,200,350,200)">
<input type = "button" value = "(500,500,300,200)으로 이동" onClick = "auto(500,500,300,200)">
<br>
<input type = "button" value = "resize" onClick = "resize()">
</body>