How to Create a Table With a Border Using Javascript

104 16
    • 1). Right-click the HTML page that you want to use to create a table. Click "Open With," then double-click the JavaScript or HTML editor in the list of programs.

    • 2). Create the JavaScript tags in the "head" tags of the HTML page. All your JavaScript code is created within these tags. Type the following code in the HTML file:

      <script type="text/javascript"> </script>

    • 3). Create the dynamic table using the "document.write" function. The following code creates a table with a "1px" border:

      document.write("<table style='border:1px solid black;"><tr><td>table data</td></tr></table>");

    • 4). Save the changes and open the HTML page in a Web browser. Notice the table is written to the page and the table has a one pixel border surrounding it.

Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.