Maison  >  Article  >  interface Web  >  Comment afficher une chaîne en police à espacement fixe ?

Comment afficher une chaîne en police à espacement fixe ?

王林
王林avant
2023-09-16 12:25:061098parcourir

Comment afficher une chaîne en police à espacement fixe ?

Utilisez la méthode fixed() de JavaScript pour afficher dans une police à espacement fixe, tout comme dans la balise .

Exemple

Vous pouvez essayer d'exécuter le code suivant pour afficher une chaîne dans une police à espacement fixe.

<html>
   <head>
      <title>JavaScript String fixed() Method</title>
   </head>

   <body>
      <script>
         var str = new String("Hello world");
         alert(str.fixed());
      </script>
   </body>
</html>

Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!

Déclaration:
Cet article est reproduit dans:. en cas de violation, veuillez contacter admin@php.cn Supprimer