Để đặt kiểu viền trái trong JavaScript, dùng thuộc tính borderLeftStyle. Đặt kiểu bạn muốn cho viền: solid, dashed, v.v.
Ví dụ
Bạn có thể chạy mã sau để học cách định kiểu viền trái −
<!DOCTYPE html> <html> <head> <style> #box { border: thick solid gray; width: 300px; height: 300px; } </style> </head> <body> <div id="box">Văn bản demo</div> <br><br> <button type="button" onclick="display()">Thay đổi kiểu viền trái</button> <script> function display() { document.getElementById("box").style.borderLeftStyle = "dashed"; } </script> </body> </html>