1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
   |  
		function GetAndEmptyChild(nom)
		{
            var child = document.getElementById(nom);
            if(child)
            {
                while( child.hasChildNodes() )
                        child.removeChild( child.childNodes[0] );
            }	
            return child;	
		}
 
 
		function AddTextInChild(child, texte)
		{		                            
            var t = document.createTextNode("");
            t.data = texte;
            child.appendChild(t);
            return t;
        }
 
		function AddInputTextInChild(child, nom, value, size, max)
		{
            var input = document.createElement("input");
            input.type = 'text';
            input.className = 'txt01';
            input.name = nom;
            input.defaultValue = value;
            input.size = size;
            input.maxLength = max;              
            child.appendChild(input);
            return input;
        }
 
        function AddHiddenInChild(child, nom, value)
        {
            var hidden = document.createElement("input");    
            hidden.type = 'hidden';
            hidden.name = nom;
            hidden.value = value;
            child.appendChild(hidden);
            return hidden;
 
        }
 
        function AddSubmitInChild(child)
        {
 
            var submit = document.createElement("input");
            submit.type = "submit";
            submit.className = "submit01";
            submit.value= "Valider";
            child.appendChild(submit);
            return submit;            
 
        }
 
        function AddBRInChild(child)
        {
            var br = document.createElement("br");
            child.appendChild(br);            
        }
 
        function AddNBSPInChild(child, n)
        {        
            for(var i=0; i<n; i++){
                nbsp = document.createTextNode('\u00A0');  
                child.appendChild(nbsp);
            }
        }
 
        function UpdateCode()
        {
 
            var index = document.formAddCode.actioncodepromo.selectedIndex;
 
            var div = GetAndEmptyChild("idContents");
 
            var form = document.createElement("form");
            form.setAttribute("action", "index.php4?p=2");
            form.setAttribute("method", "post");
 
            AddHiddenInChild(form, "idtarif", <?php echo $idtarif; ?>);            
            AddHiddenInChild(form, "actioncodepromo", index);
 
            switch(index)
            {
                case 0: // [...]                        
                        break;
 
                case 1: // [...]                        
                        break;
 
                case 2: // [...]                        
                        break;
 
                case 3: 
                        AddTextInChild(form, "Fichier de code (csv) : ");
 
                        var input = document.createElement("input");
                        input.type = 'file';
                        input.name = 'fichierdecode';
                        input.accept='text';    
                        input.size = '20';              
                        form.appendChild(input);
 
                        AddBRInChild(form);
                        AddSubmitInChild(form);
 
 
                        div.appendChild(form); 
                        break;
 
                case 4: // [...]                        
                        break;
 
                case 5: // [...]                        
                        break;
 
            }            
        } | 
Partager