SoFunction
Updated on 2025-04-13

Javascript & DHTML Upload File Control Page 3/4


<script> 
function upload(target/*Container*/
                ) 

this._cnt = 0; /*Counter*/
   = (target); 
}; 

 = function () { 
  /* 
* Generate a file
   */ 
  var self = this; var cnt = this._cnt; 
  var cFile = ("input"); 
  ="file"; ="upload"; 
   = "upload_file_" +cnt; 
  /* 
* Generate one Add
   */ 
  var cAdd = ("span"); 
="Add";
   = function () { 
    (); 
  }; 
  /* 
* Generate a delete
   */ 
  var cRemove = ("span"); 
="Delete";
   = function () { 
    (cnt); 
  }; 

   = "upload_add_" +cnt; 
   = "upload_remove_" +cnt; 

/* Add all generated information to the container */
  (cFile); 
  (cAdd); 
  (cRemove); 

/* Counter +1 */
  this._cnt++; 

return this; //Return
}; 

._removeNode = function (id) { 
  var a=(id); 
  (a); 
}; 

 = function (n) { 
  /* 
*Delete a file
   */ 
  this._removeNode("upload_file_" +n); 
  /* 
*Delete one Add
   */ 
  this._removeNode("upload_add_" +n); 
  /* 
*Delete one Delete
   */ 
  this._removeNode("upload_remove_" +n); 

  return this; 

</script>