Bonjour,
voici le script :
La fonction getLeftUrl doit renvoyer une chaîne de caractère.
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
21
22
23
24
25
26
27 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Test URL</title> </head> <body> <script type="text/javascript"> function getLeftUrl() { var url = new String(); url='http://www.google.com'; return url; } var test = new String(); test = getLeftUrl; alert(test); </script> </body> </html>
La variable test doit contenir le résultat de la fonction getLeftUrl
Résultat attendu :
Résultat obtenu :
Code : Sélectionner tout - Visualiser dans une fenêtre à part http://www.google.com
J'ai l'impression que la fonction n'est pas interprétée...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 function getLeftUrl() { var url = new String(); url='http://www.google.com'; return url; }
Sauriez-vous pourquoi ?
merci d'avance
Partager