Partage
  • Partager sur Facebook
  • Partager sur Twitter

Champs Input et Tableau

    22 juin 2018 à 12:25:21

    <!DOCTYPE html>
    	<html>
    	<head>
    		<meta charset="utf-8"/>
    		<title>TP_n2</title>
    		<link rel="stylesheet" href="form.css"/>
    		<script type="text/css">
    		
    		.input{
    	height:30px;
    	width:220px;
    }
    
    #formule1{
    	display:none;
    }
    
    </script>
    		
    		<!--java script-->
    		<script type="text/javascript">
    	
        function affiche() {
           var div = document.getElementById("formul");
           if(div.style.display == 'none'){
              div.style.display = 'block';
    		 }
           else{
              div.style.display = 'none';
    		  }
        }
    	
    	
    	function formul(){
    	var div=document.getElementById("formule1");
    	if(document.getElementById('nom').value && document.getElementById('prenom').value && document.getElementById('tel').value && document.getElementById('mail').value){
    		true;
    		div.style.display='block';
    			function tableau(){
    	getElementById('formule1')=getElementById('nom').push.row[1];
    } 
    	}
    	else{
    		false;
    		alert("Veuillez saisir toutes les informations!!!");
    	}
    	
    }
    	
    	
    </script>
    	</head>
    	
    	
    	<body>
    		<h1>Gestionnaire de contacts</h1>
    		<h2>Mes conctacts</h2>
    		<h4>Vous n'avez pas encore de contacts</h4>
    		
    		
    			<!-- tableau_head_début-->
    			<table border="1px solid yellow" style="border-collapse:collapse; width:810px;" id="formule1">
    				<thead>
    					<tr>
    						<th style="width:200px; height:40px">Noms</th> <th style="width:200px; height:40px">Prénom</th> <th style="width:200px; height:40px">Téléphone</th> <th style="width:200px; height:40px">Mail</th> <th style="width:200px; height:40px">Supprimer</th>
    					</tr>
    				</thead>
    			
    			<!-- tableau_head_fin-->
    		
    			<!-- tableau_body_début-->
    				<tbody>
    					<tr id="ligne">
    						<td style="width:200px; height:40px" id="case1"></td> <td style="width:200px; height:40px" id="case2"></td> <td style="width:200px; height:40px" id="case3"></td> <td style="width:200px; height:40px" id="case4"></td> <td style="width:200px; height:40px"> 		<button style="width:200px; height:30px; background-color:rgb(255,163,0)"><b><a href="#" onclick="" style="color:white">X</a></b></button> </td>					
    					</tr>
    					
    				</tbody>
    		
    			</table>
    			
    			<!-- tableau_body_fin-->
    
    
    	
    		<button style="width:200px; height:50px; background-color:rgb(255,163,0)" onclick="affiche()"><b>Ajouter un contact</b></button>
    		
    		
    		 <!-- les champs input -->
    			<div id="formul">
    			<h1>Ajouter un contact</h1>
    				<form>
    					<input type="text" name="nom" id="nom" placeholder="Nom du contact" class="input"/><br>
    					<br>
    					<input type="text" name="prenom" id="prenom" placeholder="Prénom" class="input"/><br>
    					<br>
    					<input type="number" name="telephone" id="tel" placeholder="Téléphone" class="input"/><br>
    					<br>
    					<input type="Email" id="mail" name="email" placeholder="Email" class="input"/><br>
    					<br>
    					<button type="button" style="width:200px; height:50px; background-color:rgb(255,163,0)" onclick="formul()"><i><b>Ajouter un contact</b></i></button>
    				
    				
    				</form>
    			</div>
    			
    			
    	</body>
    </html>
    


    Bonjour je suis entrain de m'exercer sur le java et ça fait deux jours que je blanchis mes nuit sans trouver de solution. voila j'ai crée un formulaire et un tableau, mon but est d'envoyer les éléments(du input) saisies par l'utilisateur dans le tableau. faut-il que je créee le tableau avec le js ou le garder en html? voila mon code.

    merci d'avance!

    -
    Edité par GloryMouyamba1 22 juin 2018 à 12:54:23

    • Partager sur Facebook
    • Partager sur Twitter
      22 juin 2018 à 12:36:44

      Déjà est ce que tu peux mettre ton code dans la box en utilisant l'outil </>
      • Partager sur Facebook
      • Partager sur Twitter
        22 juin 2018 à 12:40:03

        mon code n'est peut être pas professionnel :honte:  je précise que j'apprends tout seul. si vous avez des corrections à faire n' hesitez pas.
        • Partager sur Facebook
        • Partager sur Twitter
          22 juin 2018 à 12:45:53

          La n'est pas la question, modifie ton message, au dessus tu verras plusieurs petit carrée, tu cliques sur celui qui contient </> et tu met ton code dedans.

          ça nous permettra d'avoir un code plus lisible, indenté et en couleur. 

          -
          Edité par DevMercenaire 22 juin 2018 à 12:46:16

          • Partager sur Facebook
          • Partager sur Twitter

          Champs Input et Tableau

          × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
          × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
          • Editeur
          • Markdown