<html>
<head>
<title>http://www.hamgoon.pe.kr</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script>
var objDIV=null;
var objDIV2=null;
function createDIV() {
if(objDIV!=null) {
return;
}
objDIV = document.createElement("div");
objBody.appendChild(objDIV);
objDIV.innerText="생성";
objDIV.style.backgroundColor="red";
objDIV.style.top="200";
objDIV.style.left="200";
objDIV.style.width="100";
objDIV.style.height="100";
}
function removeDIV() {
if(objDIV==null) {
return;
}
objBody.removeChild(objDIV);
objDIV=null;
}
function createDIV2() {
if(objDIV2!=null) {
return;
}
objDIV2 = document.createElement("div");
objBody.appendChild(objDIV2);
objDIV2.innerText="생성";
objDIV2.style.backgroundColor="gray";
objDIV2.style.top="200";
objDIV2.style.left="200";
objDIV2.style.width="100";
objDIV2.style.height="100";
objDIV2.contentEditable=true;
}
function removeDIV2() {
if(objDIV2==null) {
return;
}
objBody.removeChild(objDIV2);
objDIV2=null;
}
function img(id) {
var img = document.getElementById(id);
img.src = "making.jpg";
}
function select() {
document.frm.ta.focus();
var txt= document.selection.createRange().text;
alert(txt);
}
</script>
</head>
<body id="objBody">
<a href="javascript:createDIV();">생성</a>
<a href="javascript:createDIV2();">생성2</a>
<a href="javascript:removeDIV();">삭제</a>
<a href="javascript:removeDIV2();">삭제2</a>
</body>
</html>
'웹' 카테고리의 다른 글
자바스크립트에서 이벤트 생성 (0) | 2009.11.10 |
---|---|
iframe 높이 자동 리사이즈 (0) | 2009.11.10 |
drag drop div (0) | 2009.10.29 |
div 영역 조절 (0) | 2009.10.29 |
Anchor Navigation (0) | 2009.10.29 |