Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # //------------------------
- # function Save_Input_File(){
- # //-- Recup des INPUT du document
- # var Tab = document.getElementsByTagName( 'INPUT');
- # var Nbr = Tab.length;
- # for( var i=0; i < Nbr; i++){
- # //-- pour les INPUT type FILE
- # if( Tab[i].type == 'file'){
- # //-- Recup objet a cloner
- # var O_Src = Tab[i];
- # O_Src.value = ''; // because F5 sous FireFox
- # //-- Recup id et name
- # var szId = O_Src.getAttribute('id');
- # var szName = O_Src.getAttribute('name');
- # //-- affecte id ou name si non renseigne
- # if( !szId && szName)
- # O_Src.setAttribute( 'id', szName);
- # if( szId && !szName)
- # O_New.setAttribute( 'name', szId);
- # //-- Creation d'un clone
- # var O_Clone = O_Src.cloneNode( true);
- # O_Src.parentNode.appendChild( O_Clone);
- # //-- save type de display, id et name
- # O_Clone.oldDisplay = O_Clone.style.display;
- # O_Clone.oldId = O_Src.getAttribute('id');
- # O_Clone.oldName = O_Src.getAttribute('name');
- # //-- on cache
- # O_Clone.style.display = 'none';
- # //-- new ID et NAME pour eviter les conflits
- # O_Clone.setAttribute( 'id', 'GF_' +Tab[i].id);
- # O_Clone.setAttribute( 'name', 'GF_' +Tab[i].id);
- # }
- # }
- # }
- # //-----------------------------
- # function Clear_Input_File( id_){
- # //-- Recup l'objet source
- # var O_Src = document.getElementById( id_);
- # if( O_Src){
- # //-- Recup l'objet clone
- # var O_Clone = document.getElementById( 'GF_' +id_);
- # //-- Creation d'un clone du clone
- # var O_New = O_Clone.cloneNode( true);
- # //-- Ajout du clone
- # O_Src.parentNode.appendChild( O_New);
- # //-- Remplacement du INPUT FILE par le clone
- # O_Src.parentNode.replaceChild( O_New, O_Src);
- # //-- Restaure id, name et affiche
- # O_New.setAttribute( 'id', O_Clone.oldId);
- # O_New.setAttribute( 'name', O_Clone.oldName);
- # O_New.style.display = O_Clone.oldDisplay;
- # }
- # }
- # //---------------------------------------------
- # function Add_Event( obj_, event_, func_, mode_){
- # if( obj_.addEventListener)
- # obj_.addEventListener( event_, func_, mode_? mode_:false);
- # else
- # obj_.attachEvent( 'on'+event_, func_);
Add Comment
Please, Sign In to add comment