Последние учебники веб-разработки
×

JavaScript Справка

обзор

JavaScript

JS строка JS Число JS операторы JS Заявления JS математический JS Дата JS массив JS логический JS RegExp JS Глобальный JS конверсионный

браузер BOM

Window Navigator Screen History Location

HTML DOM

DOM Документ DOM элементы DOM Атрибуты DOM Мероприятия DOM Стиль

HTML Объекты

<a> <abbr> <address> <area> <article> <aside> <audio> <b> <base> <bdo> <blockquote> <body> <br> <button> <canvas> <caption> <cite> <code> <col> <colgroup> <datalist> <dd> <del> <details> <dfn> <dialog> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <footer> <form> <head> <header> <h1> - <h6> <hr> <html> <i> <iframe> <img> <ins> <input> button <input> checkbox <input> color <input> date <input> datetime <input> datetime-local <input> email <input> file <input> hidden <input> image <input> month <input> number <input> password <input> radio <input> range <input> reset <input> search <input> submit <input> text <input> time <input> url <input> week <kbd> <keygen> <label> <legend> <li> <link> <map> <mark> <menu> <menuitem> <meta> <meter> <nav> <object> <ol> <optgroup> <option> <output> <p> <param> <pre> <progress> <q> <s> <samp> <script> <section> <select> <small> <source> <span> <strong> <style> <sub> <summary> <sup> <table> <td> <th> <tr> <textarea> <time> <title> <track> <u> <ul> <var> <video>

Другие объекты

CSSStyleDeclaration


 

Таблица createTHead() Method

<Таблица объекта

пример

Создание <thead> элемент (and insert a <tr> and <td> element to it) :

// Find a <table> element with id="myTable":
var table = document.getElementById("myTable");

// Create an empty <thead> element and add it to the table:
var header = table.createTHead();

// Create an empty <tr> element and add it to the first position of <thead> :
var row = header.insertRow(0);    

// Insert a new cell (<td>) at the first position of the "new" <tr> element:
var cell = row.insertCell(0);

// Add some bold text in the new cell:
cell.innerHTML = "<b>This is a table header</b>";
Попробуй сам "

Определение и использование

createTHead() метод создает пустой <thead> элемент и добавляет его к столу.

Note: Если <thead> элемент уже существует в таблице, createTHead() метод возвращает существующий, а не создает новый.

Примечание: <thead> элемент должен иметь один или более <tr> теги внутри.

Tip: Чтобы удалить <thead> элемент из таблицы, используйте deleteTHead() метод.


Поддержка браузеров

метод
createTHead() да да да да да

Синтаксис

tableObject .createTHead()

параметры

Никто

Технические подробности

Возвращаемое значение: Вновь созданный (or an existing) <thead> элемент

Еще примеры

пример

Создание и удаление <thead> элемент:

function myCreateFunction() {
    var table = document.getElementById("myTable");
    var header = table.createTHead();
    var row = header.insertRow(0);
    var cell = row.insertCell(0);
    cell.innerHTML = "<b>This is a table header</b>";
}

function myDeleteFunction() {
    document.getElementById("myTable").deleteTHead();
}
Попробуй сам "

Похожие страницы

HTML ссылка: HTML <thead> Тег


<Таблица объекта