<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=euc-kr">
<style>
#outerRasiedDiv {
background: #a2ff28; border: #000000 1px solid; color: black; height:200; left: 30px; margin: 0px; overflow: hidden; padding-bottom: 2px; padding-left: 2px; padding-right: 2px; padding-top: 2px; position: absolute; width:400; z-index: 2
}
#innerDiv {
background: #a2ff28; color: #000000; height: 100%; overflow: auto; padding-bottom: 8px; padding-left: 8px; padding-right: 8px; padding-top: 8px; width: 100%
}
</style>
<script language="javascript">
<!--
var theobject = null;
function resizeObject() {
this.el = null;
this.dir = "";
this.grabx = null;
this.graby = null;
this.width = null;
this.height = null;
this.left = null;
this.top = null;
}
function getDirection(el) {
var xPos, yPos, offset, dir;
dir = "";
xPos = window.event.offsetX;
yPos = window.event.offsetY;
offset = 8;
if (yPos<offset) dir += "n";
else if (yPos > el.offsetHeight-offset) dir += "s";
if (xPos<offset) dir += "w";
else if (xPos > el.offsetWidth-offset) dir += "e";
return dir;
}
function doDown() {
var el = getReal(event.srcElement, "className", "resizeMe");
if (el == null) {
theobject = null;
return;
}
dir = getDirection(el);
if (dir == "") return;
theobject = new resizeObject();
theobject.el = el;
theobject.dir = dir;
theobject.grabx = window.event.clientX;
theobject.graby = window.event.clientY;
theobject.width = el.offsetWidth;
theobject.height = el.offsetHeight;
theobject.left = el.offsetLeft;
theobject.top = el.offsetTop;
window.event.returnValue = false;
window.event.cancelBubble = true;
}
function doUp() {
if (theobject != null) {
theobject = null;
}
}
function doMove() {
var el, xPos, yPos, str, xMin, yMin;
xMin = 8;
yMin = 8;
el = getReal(event.srcElement, "className", "resizeMe");
if (el.className == "resizeMe") {
str = getDirection(el);
if (str == "") str = "default";
else str += "-resize";
el.style.cursor = str;
}
if(theobject != null) {
if (dir.indexOf("e") != -1)
theobject.el.style.width = Math.max(xMin, theobject.width + window.event.clientX - theobject.grabx);
if (dir.indexOf("s") != -1)
theobject.el.style.height = Math.max(yMin, theobject.height + window.event.clientY - theobject.graby);
if (dir.indexOf("w") != -1) {
theobject.el.style.left = Math.min(theobject.left + window.event.clientX - theobject.grabx, theobject.left + theobject.width - xMin);
theobject.el.style.width = Math.max(xMin, theobject.width - window.event.clientX + theobject.grabx);
}
if (dir.indexOf("n") != -1) {
theobject.el.style.top = Math.min(theobject.top + window.event.clientY - theobject.graby, theobject.top + theobject.height - yMin);
theobject.el.style.height = Math.max(yMin, theobject.height - window.event.clientY + theobject.graby);
}
window.event.returnValue = false;
window.event.cancelBubble = true;
}
}
function getReal(el, type, value) {
temp = el;
while ((temp != null) && (temp.tagName != "BODY")) {
if (eval("temp." + type) == value) {
el = temp;
return el;
}
temp = temp.parentElement;
}
return el;
}
document.onmousedown = doDown;
document.onmouseup = doUp;
document.onmousemove = doMove;
//-->
</script>
</head>
<body>
<div class=resizeMe id=outerRasiedDiv>
<div id=innerDiv>
내용~~~<br>
테두리를 잡고..크기 변경해보시요~
</div>
</div>
</body>
</html>
- 펌 - http://suldo.zotta.net/
'인터넷정보' 카테고리의 다른 글
체크박스 체크시 해당테이블 배경색바꾸기 (0) | 2007.10.17 |
---|---|
배경음악 정지버튼 이미지로 하기 (0) | 2007.10.17 |
배경음악 정지버튼 이미지로 하기 (0) | 2007.10.17 |
마우스 + 키보드 막기 (0) | 2007.10.17 |
마우스 + 키보드 막기 (0) | 2007.10.17 |
레이어의 크기를 사용자가 변경시켜보자! (0) | 2007.10.17 |
이미지 지정 시간동안 보여주고 다른 이미지 로딩 (0) | 2007.10.17 |
이미지 지정 시간동안 보여주고 다른 이미지 로딩 (0) | 2007.10.17 |
JS 한영 전환 버튼 (0) | 2007.10.17 |
JS 한영 전환 버튼 (0) | 2007.10.17 |