上传图片组


<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>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值