<html>
<head>
<title>BLUEB</title>
<head>
<script language="javascript">
<!--
function AddFile(){
var objTbl = document.all["tblAttFiles"];
var objRow = objTbl.insertRow();
var objCell = objRow.insertCell();
var addHTML = "<tr><td colspan='2' bgcolor='#FFFFFF'><table width='100%' border='0' cellpadding='3' cellspacing='0'> " +
"<tr>" +
"<td width='51%'><input type='checkbox' name='cbox'><input name='option_idx' type='text' size='45' value='0'><input name='option_name' type='text' size='45' >선택시</td>" +
"<td width='49%'>판매금액에 <input name='option_price' type='text' size='12' >원 추가</td>" +
"</tr>" +
"<tr>" +
"<td colspan='2'><TABLE width='100%' border='0' cellpadding='0' cellspacing='0'>" +
"<TR>" +
"<TD bgcolor='f6f6f6'><b><font color='627dce'>확대(원본)이미지</font></b></TD>" +
"<TD><TABLE width='100%' border='0' cellpadding='0' cellspacing='0'>" +
" <TR>" +
" <TD><INPUT name='option_image[]' type='file' size='65' class='text' onChange='CkImageVal()'></TD>" +
"</TR>" +
"</TABLE></TD>" +
"</TR>" +
"</TABLE></td>" +
"</tr>" +
"</table>" +
"</td>" +
"<td align='center' bgcolor='#FFFFFF'> </td>";
objCell.innerHTML =addHTML;
document.recalc();
}
function CkImageVal() {
var oInput = event.srcElement;
var fname = oInput.value;
if((/(.jpg|.jpeg|.gif|.png)$/i).test(fname))
oInput.parentElement.children[0].src = fname;
else
alert('이미지는 gif, jpg, png 파일만 가능합니다.');
}
function delFileUI(){
var objTbl = document.all["tblAttFiles"];
var objChk = document.all["cbox"];
var aRow=objTbl.rows;
alert(aRow.length);
for(var i=aRow.length-1;i>=0;i--) {
alert(objChk.length);
if(isNaN(objChk.length)) {
if(objChk.checked) objTbl.deleteRow();
} else {
alert(objChk[i]);
if(objChk[i].checked) objTbl.deleteRow(i);
}
}
}
//-->
</script>
</head>
<body>
<table id="tblAttFiles" width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC" >
<tr bgcolor="#f7f7f7" align="center">
<td>항목명 (예. 치크케이크)</td>
<td>가격 (무료일때는 0원입력)</td>
<td>-</td>
</tr>
<tr>
<td colspan="2" bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="3" cellspacing="0">
<tr>
<td width="51%"><input name="option_idx" type="hidden" size="45" value="0"><input name="option_name" type="text" size="45" >선택시</td>
<td width="49%">판매금액에 <input name="option_price" type="text" size="12" >원 추가</td>
</tr>
<tr>
<td colspan="2"><TABLE width="100%" border="0" cellpadding="0" cellspacing="0">
<TR>
<TD bgcolor="f6f6f6"><b><font color="627dce">확대(원본)이미지</font></b></TD>
<TD><TABLE width="100%" border="0" cellpadding="0" cellspacing="0">
<TR>
<TD><INPUT name="option_image[]" type="file" size="65" class="text" onChange='CkImageVal()'></TD>
</TR>
</TABLE></TD>
</TR>
</TABLE></td>
</tr>
</table>
</td>
<td align="center" bgcolor="#FFFFFF"> <input type=checkbox name="cbox"></td>
</tr>
</table>
<br>
<input type=button value='첨부필드 추가' onclick="AddFile()">
<input type="button" value="삭제" onclick="delFileUI();">
</body>
</html>