¼Ò½º
Ãß°¡ ¹öÆ°À» ´·¯º¸¼¼¿ä~
<div id="attachFileDiv"><input type="file" name="files" value="" size="40"><input type="button" value="Ãß°¡" onclick="attachFile.add()" style="margin-left:5px"></div>
<script language="JavaScript">
attachFile = {
idx:0,
add:function(){ // ÆÄÀÏÇʵå Ãß°¡
var o = this;
var idx = o.idx;
var div = document.createElement('div');
div.style.marginTop = '3px';
div.id = 'file' + o.idx;
var file = document.all ? document.createElement('<input name="files">') : document.createElement('input');
file.type = 'file';
file.name = 'files';
file.size = '40';
file.id = 'fileField' + o.idx;
var btn = document.createElement('input');
btn.type = 'button';
btn.value = '»èÁ¦';
btn.onclick = function(){o.del(idx)}
btn.style.marginLeft = '5px';
div.appendChild(file);
div.appendChild(btn);
document.getElementById('attachFileDiv').appendChild(div);
o.idx++;
},
del:function(idx){ // ÆÄÀÏÇÊµå »èÁ¦
if(document.getElementById('fileField' + idx).value != '' && !confirm('»èÁ¦ ÇϽðڽÀ´Ï±î?')){
return;
}
document.getElementById('attachFileDiv').removeChild(document.getElementById('file' + idx));
}
}
</script>
|