如何动态地在表的3个TD中添加3个文本框。 [英] How to add 3 text boxes in 3 TD of a table dynamically.

查看:97
本文介绍了如何动态地在表的3个TD中添加3个文本框。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<tr>
                                <td bgcolor="#FFFFFF" class="NormalText1">Attachment</td>
                                <td bgcolor="#FFFFFF" class="NormalText1">
                                <?php if($_POST['compose'] =="reply" || $_POST['compose'] =="forward"){ ?>
                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                    <?php

                                      $base_dir = "public/attachment";

foreach($this->attachments as $key =>$attach) {
?>
                                      <td>

                                      <input name="attachment_f[]" type="hidden" value="<?php echo $attach['attachment']; ?>"><a href="<?php echo URL.$base_dir."/".$attach['attachment']; ?>" class="SmallLnk" target="_blank">

                                      <?php

                                    echo $attach['attachment'];

                                      ?></a></td>
                                    </tr>
                                    <?php } ?>
                                  </table>
                                 <?php } ?><input name="attachment[]" type="file" id="image" size="55">
                                <div id="moreUploads"></div>
<div id="moreUploadsLink" style="display:block;"><a href="javascript:addFileInput();" class="SmallLnk" style="color: #FF6600">Add More Files</a></div>
                                  </td>
                              </tr>
                              <script language="javascript">
    var upload_number = 2; function addFileInput() { var d = document.createElement("div"); var l = document.createElement("a"); var file = document.createElement("input"); file.setAttribute("type", "file"); file.setAttribute("name", "attachment[]"); file.setAttribute("size", "55");l.setAttribute("href", "javascript:removeFileInput('f"+upload_number+"');");l.setAttribute("class", "SmallLnk");l.setAttribute("style", "color:#FF6600"); l.appendChild(document.createTextNode(" Remove")); d.setAttribute("id", "f"+upload_number); d.appendChild(file); d.appendChild(l); document.getElementById("moreUploads").appendChild(d); upload_number++; }

function removeFileInput(i) { var elm = document.getElementById(i); document.getElementById("moreUploads").removeChild(elm); }</script>





此代码适用于添加和删除文件..

现在我要添加和删除3个文本框控制何时需要......连续3 td。

你可以为我编辑这段代码......



This code work properly for add and remove file..
Now I want to add and remove 3 textbox controls when it require.. in 3 td of a row.
can u edit this code for me...

推荐答案

_POST [ 'compose'] = = 回复 || < span class =code-summarycomment>
_POST['compose'] =="reply" ||


_POST ['compose'] = = forward ){ >
< width = 100% border = 0 cellspacing = 0 < span class =code-attribute> cellpadding = 0 >
< tr >
<? php

< span class =code-summarycomment>
_POST['compose'] =="forward"){ ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <?php


base_dir = public / attachment ;

foreach(
base_dir = "public/attachment"; foreach(


这篇关于如何动态地在表的3个TD中添加3个文本框。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆