ใช้เมธอด fixed() ของ JavaScript เพื่อแสดงข้อความในฟอนต์ขนาดคงที่ (fixed-pitch font) กรณีอยู่ในแท็ก <tt> (teletype text)
ตัวอย่าง
ลองรันโค้ดด้านล่างเพื่อแสดงสตริงในฟอนต์ขนาดคงที่:
<html>
<head>
<title>JavaScript String fixed() Method</title>
</head>
<body>
<script>
var str = new String("Hello world");
alert(str.fixed());
</script>
</body>
</html>
ข้อควรระวัง: เมธอด fixed() เป็น Deprecated (เลิกใช้แล้ว) และถูกลบออกจากมาตรฐานเว็บ ไม่ควรใช้ในโค้ดใหม่ ให้ใช้ CSS แทน: font-family: monospace; หรือ <code>, <pre>, <kbd>, <samp> แท็ก semantic ที่เหมาะสมกว่า