Rechercher dans l’assistance

Évitez les escroqueries à l’assistance. Nous ne vous demanderons jamais d’appeler ou d’envoyer un SMS à un numéro de téléphone ou de partager des informations personnelles. Veuillez signaler toute activité suspecte en utilisant l’option « Signaler un abus ».

En savoir plus

Javascript not working in Firefox,chrome,opera but works in IE

  • 2 réponses
  • 21 ont ce problème
  • 6 vues
  • Dernière réponse par cor-el

more options

This or any other program shows nothing on screen.


<!DOCTYPE html>
<html>
<head>
	<title> Epic! </title>
</head>
<body>
<script type="text/javascript">

var name = new Array("jon","cody","molly");
name.sort();
for (j=0;j<name.length;j++){
document.write(name[j] + "<br>");
}


</script>
</body>
</html>

................................................................................................................................
this say 
,,Undefined

<!DOCTYPE html>
<html>
<head>
	<title> Epic! </title>
</head>
<body>
<script type="text/javascript">

var name = new Array(3);
for (j=0;j<3;j++){
name[j] = prompt ("enter 3 names " ,"");
}
document.write(name[0] + name[1] + name[2]);



</script>
</body>
</html>
This or any other program shows nothing on screen. <pre><nowiki><!DOCTYPE html> <html> <head> <title> Epic! </title> </head> <body> <script type="text/javascript"> var name = new Array("jon","cody","molly"); name.sort(); for (j=0;j<name.length;j++){ document.write(name[j] + "<br>"); } </script> </body> </html> ................................................................................................................................ this say ,,Undefined <!DOCTYPE html> <html> <head> <title> Epic! </title> </head> <body> <script type="text/javascript"> var name = new Array(3); for (j=0;j<3;j++){ name[j] = prompt ("enter 3 names " ,""); } document.write(name[0] + name[1] + name[2]); </script> </body> </html></nowiki></pre>

Modifié le par cor-el

Toutes les réponses (2)

more options

hi Jon92, support.mozilla.org is intended for end-user support. if you have a question regarding web development please refer to Where to go for developer support instead. thank you for your understanding!

more options

That is because "name" is a reserved variable name and can't be used. Just choose something else for the variable name and it will work ('Name' works, may fail in a future Firefox version). You should always be cautious when you choose a common name as the name of a variable as such a name may become reserved.


Web Console: TypeError: name.sort is not a function

Modifié le par cor-el