Computer >> คอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Javascript

จะตั้งค่าคุณสมบัติของกฎคอลัมน์ด้วย JavaScript ได้อย่างไร?


The columnRule มีการใช้คุณสมบัติใน JavaScript เพื่อกำหนดกฎของคอลัมน์ ช่วยให้คุณกำหนดรูปแบบ สี และความกว้างระหว่างกฎของคอลัมน์ได้

ตัวอย่าง

คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อตั้งค่าคุณสมบัติของกฎของคอลัมน์ด้วย JavaScript -

<!DOCTYPE html>
<html>
   <body>
      <p>Click below to create 4 columns</p>
      <button onclick="display()">Columns</button>
      <div id="myID">
         This is demo text. This is demo text. This is demo text. This is demo text.
         This is demo text. This is demo text. This is demo text. This is demo text.
         This is demo text. This is demo text. This is demo text. This is demo text.
         This is demo text. This is demo text. This is demo text. This is demo text.
         This is demo text. This is demo text. This is demo text. This is demo text.
         This is demo text. This is demo text. 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("myID").style.columnCount = "4";
            document.getElementById("myID").style.columnRule = "2px outset red";
         }
      </script>
   </body>
</html>