[RESOLU] affiche l'écran d'une calculatrice

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : [RESOLU] affiche l'écran d'une calculatrice

Re: affiche l'écran d'une calculatrice

par passnic » 27 mars 2015, 10:13

merci j'ai résolu le problème!

Re: affiche l'écran d'une calculatrice

par moogli » 26 mars 2015, 23:57

salut,

je pense que ta solution se trouve du coté de javascript.
les clics actionnent une fonction javascript, qui te permet d'afficher la saisie (par exemple dans un champs read only).
lorsque tu cliques sur le bouton pour valider c'est ceci que tu utilise pour le calcul.

@+

affiche l'écran d'une calculatrice

par passnic » 26 mars 2015, 15:18

Bonjour, je viens de commencer le php et j'aimerai réaliser une calculatrice basique. je suis bloqué au niveau de l'affichage de l'expression arithmétique de saisie du clavier. je voudrai afficher toutes les saisies du clavier avant d’évaluer l'expression
voici mon code:
<!doctype html>
<html lang="fr">
	<head>
		<title>Calculatrice</title>
		<meta charset="utf-8">
		<style>
         table { border-collapse:collapse; }
         table,td { border:1px solid black; font-family:monospace;}
         td { padding:15px; }
         a { text-decoration:none; }
		</style> 
     
    </head>
    <body>
		<h2>Calculatrice</h2>
		<table>
			<tr>
       		  	<td><a href="calculatrice.php?fonction=e">E</a></td>
                <td><a href="calculatrice.php?fonction=c">C</a></td>
                <td><a href="calculatrice.php?touche=%28">(</a></td>
				<td><a href="calculatrice.php?touche=%29">)</a></td>
			</tr>
			<tr>
				<td><a href="calculatrice.php?touche=7">7</a></td>
				<td><a href="calculatrice.php?touche=8">8</a></td>
                <td><a href="calculatrice.php?touche=9">9</a></td>
                <td><a href="calculatrice.php?touche=%2B">+</a></td>
			</tr>
            <tr>
				<td><a href="calculatrice.php?touche=4">4</a></td>
				<td><a href="calculatrice.php?touche=5">5</a></td>
                <td><a href="calculatrice.php?touche=6">6</a></td>
                <td><a href="calculatrice.php?touche=-">-</a></td>
			</tr>
            <tr>
				<td><a href="calculatrice.php?touche=1">1</a></td>
				<td><a href="calculatrice.php?touche=2">2</a></td>
                <td><a href="calculatrice.php?touche=3">3</a></td>
                <td><a href="calculatrice.php?touche=%2A">*</a></td>
			</tr>
            <tr>
				<td><a href="calculatrice.php?touche=0">0</a></td>
				<td><a href="calculatrice.php?touche=%2C">,</a></td>
                <td><a href="calculatrice.php?touche=%3D">=</a></td>
                <td><a href="calculatrice.php?touche=%2F">/</a></td>
			</tr>
            
		</table>
			<p><b>Expression:</b> <?php 
									$expression='';
									if (isset($_GET['touche']))
									{$expression.=$_GET['touche'] ;
									
									}echo $expression;
								   ?> 
			<p><b>Résultat:</b>								</p>
    </body>
</html>