คุณสมบัติ unicodeBidi สไตล์ HTML DOM ส่งคืนและแก้ไขว่าข้อความควรถูกแทนที่หรือไม่เพื่อรองรับหลายภาษาในเอกสาร HTML เดียวกันพร้อมกับคุณสมบัติทิศทาง
ไวยากรณ์
ต่อไปนี้เป็นไวยากรณ์ -
-
ส่งคืน unicodeBidi
object.style.unicodeBidi
-
กำลังแก้ไข unicodeBidi
object.style.unicodeBidi = “value”
คุณค่า
ในที่นี้ ค่าสามารถเป็น −
| ค่า | คำอธิบาย |
|---|---|
| สืบทอด | รับค่าคุณสมบัตินี้จากองค์ประกอบหลัก |
| เริ่มต้น | ตั้งค่าคุณสมบัตินี้เป็นค่าเริ่มต้น |
| ปกติ | ไม่ได้กำหนดระดับการฝังเพิ่มเติม |
| ฝัง | กำหนดระดับการฝังเพิ่มเติม |
| การแทนที่การเสนอราคา | ตั้งค่าระดับการฝังเพิ่มเติมและจัดลำดับใหม่ตามคุณสมบัติของทิศทาง |
ตัวอย่าง
ให้เราดูตัวอย่างคุณสมบัติ unicodeBidi สไตล์ HTML DOM -
<!DOCTYPE html>
<html>
<head>
<style>
body {
color: #000;
background: lightblue;
height: 100vh;
text-align: center;
}
.btn {
background: #db133a;
border: none;
height: 2rem;
border-radius: 2px;
width: 40%;
display: block;
color: #fff;
outline: none;
cursor: pointer;
margin: 1rem auto;
}
</style>
</head>
<body>
<h1>DOM Style transformStyle Property Example</h1>
<p style="direction:ltr">This is a paragraph element with some dummy text.</p>
<button onclick="add()" class="btn">Set unicodeBidi</button>
<script>
function add() {
document.querySelector('p').style.direction = "rtl";
document.querySelector('p').style.unicodeBidi = "bidi-override";
}
</script>
</body>
</html> ผลลัพธ์
สิ่งนี้จะสร้างผลลัพธ์ต่อไปนี้ -

คลิกที่ “ตั้งค่า unicodeBidi ” เพื่อตั้งค่าคุณสมบัติ unicodeBidi CSS บนองค์ประกอบย่อหน้า
