Results 1 to 2 of 2

Thread: Re-Ordering table columns

Hybrid View

  1. #1
    Join Date
    Aug 2013

    Re-Ordering table columns

    I hope there is help out there.

    I have a 3 column table. It displays results from a pool match. But the software I use to generate the html page currently shows

    Player A - Player B - Result

    What I hope to achieve is

    Player A - Result - Player B

    Here is the table I working with, on a small scale.

    <TABLE class="table1">
    <TD class="ko3-text">Geraldo Depp(Dun Mare)</TD>
    <TD class="ko3-text">Darin Hanley(Bradford B)</TD>
    <TD class="ko-data">7- 5</TD>

    Can anybody help me swap Column 2 and 3?

  2. #2
    Join Date
    May 2006
    Somewhere behind your screen
    try this

    <!DOCTYPE html>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>Swap Cells</title>
    <script type="text/javascript">
    function swapper(tab){
    var trs=tab.rows;
    for(var i=0;i<trs.length;i++){
    var c1=trs[i].cells[1],val1=c1.innerHTML,c2=trs[i].cells[2],val2=c2.innerHTML;
    <table class="table1">
    <td class="ko3-text">Geraldo Depp(Dun Mare)</td>
    <td class="ko3-text">Darin Hanley(Bradford B)</td>
    <td class="ko-data">7- 5</td>
    <td class="ko3-text">Player A</td>
    <td class="ko3-text">Player B</td>
    <td class="ko-data">Score A - B</td>
    <td class="ko3-text">Player C</td>
    <td class="ko3-text">Player D</td>
    <td class="ko-data">Score C - D</td>
    <br /><br /><br />
    <a href="#null" id="swp">swap</a>
    signature under construction

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center