我有一个JavaScript函数,可以为上传图片创建输入区域。JavaScript功能限制
我有这样的代码:
<script type="text/javascript">
function add_input(){
var wo = document.getElementById('wo');
var li = document.createElement('li');
var input = document.createElement('input');
input.type = 'file';
input.name = 'image[]';
li.appendChild(input);
li.appendChild(document.createTextNode(' '));
var button=document.createElement('input');
button.type = 'button';
button.className = 'button small';
button.onclick=function(){delete_input(this);};
button.value = 'delete';
li.appendChild(button);
wo.appendChild(li);
}
function delete_input(feld){
feld.parentNode.parentNode.removeChild(feld.parentNode);
}
</script>
我现在的问题是,我想创建为最大10个inputfields。我从来没有使用JavaScript之前,不知道如何限制。
如果有人能告诉我如何认识到我真的很感激。非常感谢。
多数民众赞成它。非常感谢。再见 – bonny 2012-04-12 09:01:21