<script type=text/javascript>
function ctrlImgList(n)
{
n = n == -1 ? -1 : 1;
var o = document.getElementById('pic');
var lst = o.getElementsByTagName('input');
if ( n==1 && lst.length<5 )
{
var newimg = document.createElement('input');
newimg.name = 'image[]';
newimg.type = 'file';
newimg.οnchange=function() {
if( this.value )
{
ctrlImgList(1);
}
}
o.appendChild(newimg);
}
else if( n==-1 && lst.length>=1 )
{
o.removeChild(lst[lst.length-1]);
}
}
</script><style type="text/css">
<!--
body,td,th {
font-family: Georgia, Times New Roman, Times, serif;
}
#pic {
width:150px; margin:0 auto; padding:0px 0px 0px 0px;
}
#pic ul {
float:left; margin:0 auto; padding:0px 0px 0px 0px; list-style-type:none;
}
#pic ul li {
float:left; margin:0 auto; padding:0px 0px 0px 0px; width:150px; height:100px;
}
-->
</style>
<form method="post" enctype="multipart/form-data" action="top.php">
<div id="pic">
<ul>
<li>
<input type=file name=image[] οnchange="ctrlImgList(1)" />
</li>
</ul>
</div>
<input type=button value="+" οnclick="ctrlImgList(1)" /><input type=button value="-" οnclick="ctrlImgList(-1)" />
<input type="submit" value="Submit" />
</form>