クラス拟161メールボックスに添付ファイルのJSを一括追加します.


<script language="javascript" >
var i=1;
var imagemax=5; //imagemax           

function addFile()
{
    if(i<imagemax)
    { 
        i++;
        currRow=conditionTable.insertRow();
        cellc=currRow.insertCell();
        cellcContext= '<input type="file" NAME="File+"+i>  <button onclick="removeFile();" class="botheight">  </button><br>';
        cellc.innerHTML=cellcContext;
    }
}

function findTD(o)
{
    if (o.nodeName=="TR"||o.nodeName=="TABLE") return;
    if(o.nodeName=="TD")
    return (o);
    else
    return (o.parentElement);
}

function removeFile()
{
    o = findTD(event.srcElement);
    //alert("    ,   " + o.parentElement.rowIndex*1 + "   ");
    conditionTable.deleteRow(o.parentElement.rowIndex*1);
    i--;
}

function addimage()
{
    document.write("<div id='fileDiv'><table id=conditionTable border=0><tr><td><input type='file' NAME='File1'>  <button onclick='removeFile();' class='botheight'>  </button><br</td></tr></table></div>");
    if(i==0){
    document.write("<a href='javascript:void(addFile());' class='file'>    </a>       "+imagemax+"   ");
    }else{
    document.write("<a href='javascript:void(addFile());' class='file'>      </a>       "+imagemax+"   ");
    }
}
</script>

<script>
<!--
addimage();
-->
</script>