ใช้ ตัวแบ่งคำ คุณสมบัติใน JavaScript เพื่อตั้งกฎการแบ่งบรรทัดสำหรับสคริปต์ที่ไม่ใช่ CJK ต่อไปนี้คือสคริปต์ CJK:C สำหรับภาษาจีน J สำหรับภาษาญี่ปุ่น K สำหรับภาษาเกาหลี
ตัวอย่าง
คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อเรียนรู้วิธีใช้งาน wordbreak ทรัพย์สิน −
<!DOCTYPE html>
<html>
<head>
<style>
#box {
width: 150px;
height: 120px;
background-color: lightblue;
border: 1px solid black;
}
</style>
</head>
<body>
<button onclick = "display()">Set</button>
<div id = "box">
This is Demo Text.This is Demo Text.This is Demo Text.This is Demo Text.This is Demo Text.This is Demo Text.
</div>
<script>
function display() {
document.getElementById("box").style.wordBreak = "break-all";
}
</script>
</body>
</html>