When JavaScript controls the table TR display block mode, only the first cell is valid

Source: Internet
Author: User

There is a simple table:


<table > <tr > <th> numbering </th> <th> type </th> <th> detail </th> <th> Create Time < /th> <th> Modify Time </th> <th> actions </th> </tr> <tr>  <td>5</th> <td >TECH</th> <td> test content </th> <td>2014?01?10 16:56:31</th> <td>?? </th> <td> Modify Delete </th> </tr>  <tr id= "Id_dync" style= "Display:none" > <td colspan=6 > <div id=xxxx > Test content </div> </td> </tr> </table>

You want to control the third line of TR implicit state via javascript:

var tr_modifing = document.getElementById ("Id_dync"); tr_modifing.style.display = "block";

When this style.display is set to block, only the first cell TD is available:


The reason is that after tr.style.display = "Block", the TR is not a normal "table" of "line", and just like ordinary div like ordinary blocks, so the following

<>

And as it fails, the right thing to do is

var tr_modifing = document.getElementById ("Id_dync"); tr_modifing.style.display = "";

The display mode of the TR will be set to empty, this property dispaly nothing behind, very strange, so it is compatible with Firefox and IE.



When JavaScript controls the table TR display block mode, only the first cell is valid

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.