
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
With JavaScript how to change the width of a table border?
To change the width of a table border, use the DOM border property. You can try to run the following code to change the width of a table border in JavaScript −
Example
<!DOCTYPE html> <html> <head> <script> function borderFunc(x) { document.getElementById(x).style.border = "5px dashed blue"; } </script> </head> <body> <table style = "border:2px solid black" id = "newtable"> <tr> <td>One</td> <td>Two</td> </tr> <tr> <td>Three</td> <td>Four</td> </tr> <tr> <td>Five</td> <td>Six</td> </tr> </table> <p> <input type = "button" onclick = "borderFunc('newtable')" value = "Change Border Width"> </p> </body> </html>
- Related Articles
- Change the width of the bottom border with CSS
- How to set the width of the right border with JavaScript?
- How to set the width of the left border with JavaScript?
- How to set the width of the bottom border with JavaScript?
- How to set the width of the top border with JavaScript?
- How to set border width, border style, and border color in one declaration with JavaScript?
- How to set the width of an element's border with JavaScript?
- Set the width of image border with CSS
- Set border width with CSS
- Set the border image width with CSS
- How to set Line Border color and width with Java?
- How to use JavaScript DOM to change the padding of a table?
- Set whether the table border should be collapsed into a single border or not with JavaScript?
- Change the color of right border with CSS
- Change the style of top border with CSS

Advertisements