Bonjour à tous,
Je veux créer un site ou l'utilisateur tape des formules sur une calculatrice virtuelle et les formules apparaissent immédiatement. J'ai réussi à faire apparaitre des formules en utilisant MathML et MathJax, ça marche parfaitement mais MathML pose quelques problèmes avec le CSS. J'ai fait apparaitre ces formules avec du PHP et du JavaScript.
Par contre, quand l'utilisateur appuie sur la touche racine, j'ai le code Latex \sqrt{R} qui apparait, pas le symbole. Je joins mes codes PHP et JavaScript. Je suis débutant.
Code PHP : Sélectionner tout - Visualiser dans une fenêtre à part 
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170<!DOCTYPE html> <html lang="fr"> <head> <meta name="author" content="Vincent & Leo" /> <meta name="keywords" content="" /> <meta content="text/html; Charset=UTF-8" http-equiv="Content-Type" /> <link rel="stylesheet" href="style.css" type="text/css" /> <title>Balise Math</title> <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> <script type="text/javascript" src="fonction.js"></script> </head> <body> <header> <h1>Mon super site</h1> <h2>Mon super site permet de faire plein de super trucs</h2> </header> <div id="centrePage"> <nav> <!-- Menu --> </nav> <div id="coeurSite"> <h1>Multiplications et divisions de fractions<br />en utilisant la balise math</h1> <div id="fraction"> <?php echo' <table>'."\n"; // 5 lignes for($i=0;$i<5;$i++) { echo' <tr class="ligne">'."\n"; // 4 colonnes for($j=0;$j<3;$j++) { $alea1=rand(2,11); $alea2=rand(2,11); $alea3=rand(2,10); $alea4=rand(2,10); $alea5=rand(2,10); $alea6=rand(2,10); $n1=$alea1*$alea3; $d2=$alea1*$alea6; $n2=$alea2*$alea4; $d1=$alea2*$alea5; echo' <td class="formule">'."\n"; echo' <math xmlns="http://www.w3.org/1998/Math/MathML" display="block">'."\n"; echo' <mrow>'."\n"; echo' <mfrac>'."\n"; echo' <mrow>'."\n"; echo' <mn id="n1">'.$n1.'</mn>'."\n"; echo' </mrow>'."\n"; echo' <mrow>'."\n"; echo' <mn id="d1">'.$d1.'</mn>'."\n"; echo' </mrow>'."\n"; echo' </mfrac>'."\n"; echo' <mo>×</mo>'."\n"; echo' <mfrac>'."\n"; echo' <mrow>'."\n"; echo' <mn id="n2">'.$n2.'</mn>'."\n"; echo' </mrow>'."\n"; echo' <mrow>'."\n"; echo' <mn id="d2">'.$d2.'</mn>'."\n"; echo' </mrow>'."\n"; echo' </mfrac>'."\n"; echo' <mo>=</mo>'."\n"; echo' </mrow>'."\n"; echo' </math>'."\n"; echo' </td>'."\n"; } echo' </tr>'."\n"; } echo' </table>'."\n"; ?> </div> <div> <table id="calculatrice"> <caption>Calculatrice</caption> <thead> <tr> <th id="ecranCalculatrice" colspan="5"> <form> </form> </th> </tr> </thead> <tbody> <tr class="ligneCalculatrice"> <td id="toucheRac" class="uneToucheCalculatriceSpeciale" onclick="return afficherTouche(18);"><a href="#calculatrice">\(\sqrt{\ x}\)</a></td> <td id="toucheFrac" class="uneToucheCalculatriceSpeciale" onclick="return afficherTouche(19);"><a href="#calculatrice">\(\frac{N}{D}\)</a></td> <td id="toucheCos" class="uneToucheCalculatriceSpeciale" onclick="return afficherTouche(20);"><a href="#calculatrice">cos</a></td> <td id="toucheSin" class="uneToucheCalculatriceSpeciale" onclick="return afficherTouche(21);"><a href="#calculatrice">sin</a></td> <td id="toucheTan" class="uneToucheCalculatriceSpeciale" onclick="return afficherTouche(22);"><a href="#calculatrice">tan</a></td> </tr> <tr class="ligneCalculatrice"> <td id="touche7" class="uneToucheCalculatrice" onclick="return afficherTouche(0);"><a href="#calculatrice">7</a></td> <td id="touche8" class="uneToucheCalculatrice" onclick="return afficherTouche(1);"><a href="#calculatrice">8</a></td> <td id="touche9" class="uneToucheCalculatrice" onclick="return afficherTouche(2);"><a href="#calculatrice">9</a></td> <td id="toucheAC" class="deuxToucheCalculatrice" colspan="2" onclick="return afficherTouche(3);"><a href="#calculatrice">AC</a></td> </tr> <tr class="ligneCalculatrice"> <td id="touche4" class="uneToucheCalculatrice" onclick="return afficherTouche(4);"><a href="#calculatrice">4</a></td> <td id="touche5" class="uneToucheCalculatrice" onclick="return afficherTouche(5);"><a href="#calculatrice">5</a></td> <td id="touche6" class="uneToucheCalculatrice" onclick="return afficherTouche(6);"><a href="#calculatrice">6</a></td> <td id="toucheFois" class="uneToucheCalculatrice" onclick="return afficherTouche(7);"><a href="#calculatrice"> × </a></td> <td id="toucheDiv" class="uneToucheCalculatrice" onclick="return afficherTouche(8);"><a href="#calculatrice"> ÷ </a></td> </tr> <tr class="ligneCalculatrice"> <td id="touche1" class="uneToucheCalculatrice" onclick="return afficherTouche(9);"><a href="#calculatrice">1</a></td> <td id="touche2" class="uneToucheCalculatrice" onclick="return afficherTouche(10);"><a href="#calculatrice">2</a></td> <td id="touche3" class="uneToucheCalculatrice" onclick="return afficherTouche(11);"><a href="#calculatrice">3</a></td> <td id="touchePlus" class="uneToucheCalculatrice" onclick="return afficherTouche(12);"><a href="#calculatrice"> + </a></td> <td id="toucheMoins" class="uneToucheCalculatrice" onclick="return afficherTouche(13);"><a href="#calculatrice"> - </a></td> </tr> <tr class="ligneCalculatrice"> <td id="toucheDel" class="uneToucheCalculatrice" onclick="return afficherTouche(14);"><a href="#calculatrice">←</a></td> <td id="touche0" class="uneToucheCalculatrice" onclick="return afficherTouche(15);"><a href="#calculatrice">0</a></td> <td id="touchePoint" class="uneToucheCalculatrice" onclick="return afficherTouche(16);"><a href="#calculatrice">.</a></td> <td id="toucheEgal" class="deuxToucheCalculatrice" colspan="2" onclick="return afficherTouche(17);"><a href="#calculatrice">=</a></td> </tr> </tbody> </table> </div> </div> <div id="aide"> <!-- aide --> </div> </div> <footer> <!-- footer --> <script type="text/javascript"> document.write('<math xmlns="http:\/\/www.w3.org\/1998\/Math\/MathML" display="block">'); document.write(' <mrow>'); document.write(' <mfrac>'); document.write(' <mrow>'); document.write(' <mn id="n1">120</mn>'); document.write(' </mrow>'); document.write(' <mrow>'); document.write(' <mn id="d1">36</mn>'); document.write(' </mrow>'); document.write(' </mfrac>'); document.write(' <mo>=</mo>'); document.write(' </mrow>'); document.write('</math>'); </script> <script type="text/javascript"> document.write('<math xmlns="http:\/\/www.w3.org\/1998\/Math\/MathML" display="block">'); document.write(' <mrow>'); document.write(' <mfrac>'); document.write(' <mrow>'); document.write(' <mn id="n1"> ░ </mn>'); document.write(' </mrow>'); document.write(' <mrow>'); document.write(' <mn id="d1"> ░ </mn>'); document.write(' </mrow>'); document.write(' </mfrac>'); document.write(' <mo>=</mo>'); document.write(' </mrow>'); document.write('</math>'); </script> </footer> </body> </html>
Code JavaScript : Sélectionner tout - Visualiser dans une fenêtre à part 
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
Merci pour votre aide

 

 
		
		 
        

 
			
			


 
			 
   
 


 Insérer des formules mathématiques dynamiquement
 Insérer des formules mathématiques dynamiquement
				 Répondre avec citation
  Répondre avec citation
Partager