Guest User

Untitled

a guest
May 25th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. # //------------------------
  2. # function Save_Input_File(){
  3. # //-- Recup des INPUT du document
  4. # var Tab = document.getElementsByTagName( 'INPUT');
  5. # var Nbr = Tab.length;
  6. # for( var i=0; i < Nbr; i++){
  7. # //-- pour les INPUT type FILE
  8. # if( Tab[i].type == 'file'){
  9. # //-- Recup objet a cloner
  10. # var O_Src = Tab[i];
  11. # O_Src.value = ''; // because F5 sous FireFox
  12. # //-- Recup id et name
  13. # var szId = O_Src.getAttribute('id');
  14. # var szName = O_Src.getAttribute('name');
  15. # //-- affecte id ou name si non renseigne
  16. # if( !szId && szName)
  17. # O_Src.setAttribute( 'id', szName);
  18. # if( szId && !szName)
  19. # O_New.setAttribute( 'name', szId);
  20. # //-- Creation d'un clone
  21. # var O_Clone = O_Src.cloneNode( true);
  22. # O_Src.parentNode.appendChild( O_Clone);
  23. # //-- save type de display, id et name
  24. # O_Clone.oldDisplay = O_Clone.style.display;
  25. # O_Clone.oldId = O_Src.getAttribute('id');
  26. # O_Clone.oldName = O_Src.getAttribute('name');
  27. # //-- on cache
  28. # O_Clone.style.display = 'none';
  29. # //-- new ID et NAME pour eviter les conflits
  30. # O_Clone.setAttribute( 'id', 'GF_' +Tab[i].id);
  31. # O_Clone.setAttribute( 'name', 'GF_' +Tab[i].id);
  32. # }
  33. # }
  34. # }
  35. # //-----------------------------
  36. # function Clear_Input_File( id_){
  37. # //-- Recup l'objet source
  38. # var O_Src = document.getElementById( id_);
  39. # if( O_Src){
  40. # //-- Recup l'objet clone
  41. # var O_Clone = document.getElementById( 'GF_' +id_);
  42. # //-- Creation d'un clone du clone
  43. # var O_New = O_Clone.cloneNode( true);
  44. # //-- Ajout du clone
  45. # O_Src.parentNode.appendChild( O_New);
  46. # //-- Remplacement du INPUT FILE par le clone
  47. # O_Src.parentNode.replaceChild( O_New, O_Src);
  48. # //-- Restaure id, name et affiche
  49. # O_New.setAttribute( 'id', O_Clone.oldId);
  50. # O_New.setAttribute( 'name', O_Clone.oldName);
  51. # O_New.style.display = O_Clone.oldDisplay;
  52. # }
  53. # }
  54. # //---------------------------------------------
  55. # function Add_Event( obj_, event_, func_, mode_){
  56. # if( obj_.addEventListener)
  57. # obj_.addEventListener( event_, func_, mode_? mode_:false);
  58. # else
  59. # obj_.attachEvent( 'on'+event_, func_);
Add Comment
Please, Sign In to add comment