bonjour;
j'aimerai bien ecrire un script qui joue le rôle d'une simple calculatrice. voila mon code mais je sais pas pourquoi il ne marche pas; aider moi s'il vous plaît . voila mon code
merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Document sans nom</title> <script type="text/javascript"> function calculatrice(a){ var n; n=eval("a"); return n } </script> </head> <body> <form name="calcul"> Calcul : <input type="text" name="acalculer" value="" /> <input type="button" value="Calculer" onclick="calcul.calculer.value=calculatrice(calcul.acalculer.value);" /> Résultat <input type="text" name="calculer" value="" /> </form> </body> </html>
Partager