HTML DOM borderLeft 属性

定义和用法

borderLeft 属性在一个声明中为左边框设置所有属性。

语法:

  1. Object.style.borderLeft=borderWidth borderStyle borderColor

可能的值:

描述
borderWidth 设置边框的宽度。 - thin - medium - thick - length
borderStyle 设置边框的样式。 - none - hidden - dotted - dashed - solid - double - groove - ridge - inset - outset
borderColor 设置边框的颜色。 - color-name - color-rgb - color-hex - transparent

实例

本例改变左边框的宽度、样式和颜色:

  1. <html>
  2. <head>
  3. <style type="text/css">
  4. p
  5. {
  6. border: thin dotted #FF0000
  7. }
  8. </style>
  9. <script type="text/javascript">
  10. function changeBorder()
  11. {
  12. document.getElementById("p1").style.borderLeft="thick solid #0000FF";
  13. }
  14. </script>
  15. </head>
  16. <body>
  17.  
  18. <input type="button" onclick="changeBorder()"
  19. value="Change left border" />
  20.  
  21. <p id="p1">This is a paragraph</p>
  22.  
  23. </body>
  24. </html>