3초기억력

javascript - block, none 으로 폼변경, 값 전송 본문

플밍_기타

javascript - block, none 으로 폼변경, 값 전송

잠수콩 2011. 3. 25. 13:29



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">

<script language="javascript">
function sub(no){
var obj = eval("document.frm"+no)
alert("전송")
return false;
}


var curno = 0

function doReset(no){
var obj = eval("document.frm"+no)
document.getElementById("l"+no).style.display = "block"
document.getElementById("m"+no).style.display = "none"
//document.getElementById("n"+no).style.border = "0px none"
obj.n.readOnly = true
obj.reset()


}

function modify(no){
if(this.curno>0){
doReset(this.curno)
}
this.curno = no;
var obj = eval("document.frm"+no)
obj.n.readOnly = false
document.getElementById("l"+no).style.display = "none"
document.getElementById("m"+no).style.display = "block"
document.getElementById("n"+no).style.border = "1px blue"
}



</script>

 </HEAD>

 <BODY>
  <table >
<form name="frm1" onsubmit="return sub(1)">
<tr>
<td><input type="text" name="n" id="n1" value="1번입니다." style="border:0px solid white" onfocus="this.blur" readOnly></td>
<td>
<div id="l1" style="display:block">
<input type="button" value="수정" onclick="modify(1)">
<input type="button" value="삭제">
</div>
<div id="m1" style="display:none">
<input type="submit" value="확인">
<input type="button" value="취소" onclick="doReset(1)">
</div>
</td>
</tr>
</form>
<form name="frm2" onsubmit="return sub(2)">
<tr>
<td><input type="text" name="n" id="n2" value="2번입니다." style="border:0px solid white" readOnly></td>
<td>
<div id="l2" style="display:block">
<input type="button" value="수정" onclick="modify(2)">
<input type="button" value="삭제">
</div>
<div id="m2" style="display:none">
<input type="submit" value="확인">
<input type="button" value="취소" onclick="doReset(2)">
</div>
</td>
</tr>
</form>
<form name="frm3" onsubmit="return sub(3)">
<tr>
<td><input type="text" name="n" id="n3" value="3번입니다." style="border:0px solid white" readOnly></td>
<td>
<div id="l3" style="display:block">
<input type="button" value="수정" onclick="modify(3)">
<input type="button" value="삭제">
</div>
<div id="m3" style="display:none">
<input type="submit" value="확인">
<input type="button" value="취소" onclick="doReset(3)">
</div>
</td>
</tr>
</form>
</table>
 </BODY>
</HTML>

Comments