码迷,mamicode.com
首页 > 其他好文 > 详细

动态添加input功能

时间:2015-01-12 16:03:21      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:

动态添加input功能:

<script>     var TfileUploadNum=3; //记录图片选择框个数     var Tnum=3; //ajax上传图片时索引     function TAddFileUpload() {         var idnum1 = TfileUploadNum+1;         var idnum2 = TfileUploadNum+2;         var str="<div id=‘fileDataDiv[";         str+=idnum1;         str+="]‘ class=‘module_border‘><div class=‘l‘> 商品图片";         str+=idnum2;         str+=":</div><div class=‘c‘><input id=‘fileData[";         str+=idnum1;         str+="]‘ name=‘fileData[";         str+=idnum1;         str+="]‘  type=‘file‘ onchange=‘StatusValuesFunctiong(";         str+=idnum1;         str+=");‘";         str+="class=‘input_border‘/>";         str+="<input id=‘fileDataValue[";         str+=idnum1;         str+="]‘  name=‘fileDataValue[";         str+=idnum1;         str+="]‘ type=‘text‘ style=‘width:330px;‘ readonly=‘readonly‘/>";         str+="<input type=‘button‘ onclick=‘deleteDiv(";         str+=idnum1;         str+=");‘ value=‘删除‘>";         str+="</div></div>";         $(‘#provincecode‘).append(str);         TfileUploadNum += 1;     }

    function deleteDiv(statusValue){         document.getElementById("fileDataDiv["+statusValue+"]").style.display=‘none‘;     } </script>

<div id="provincecode" class="module_border">             <div id="fileDataDiv[0]" class="module_border">                 <div class="l">                     商品图片1:                 </div>                 <div class="c">                     <input id="fileData[0]" name="fileData[0]"  type="file" onchange="StatusValuesFunctiong(0);" value="1"/>                     <input id="fileDataValue[0]"  name="fileDataValue[0]" type="text" style="width:330px;" readonly="readonly"/>                     <input type="button" onclick="deleteDiv(0);" value="删除">                 </div>             </div>

 <input type="button" id="AddUpload" onclick="TAddFileUpload();" value="更多商品图片添加"/> </div>

动态添加input功能

标签:

原文地址:http://www.cnblogs.com/zifashaonian10000/p/4218340.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!