Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6848683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:53:56+00:00 2026-05-27T00:53:56+00:00

I’m having some trouble getting my Table and Colspans to work. I’m trying to

  • 0

I’m having some trouble getting my Table and Colspans to work. I’m trying to create a grid that can be used as a calendar. Each ‘table’ can represent a working day period (8:30pm til 6pm).

In my design I seperated this into 38 columns, one for each 15 minute time span.

I’ve done this so that I can display non-overlapping events next to each other, and ones that conflict with an already ‘used’ cell, can be created on a new row within this table.

However, with 38 columns in my design, my colspans are not working.

My first row is set to be 19 and 19, so 50%.
My second row is set to be 38, so that’s 100%.

Yet when IE is rendering this, it’s displaying the first row as around a 30% / 70% split.

My HTML/CSS/Javascript is below:

<html>
<head>
<script type="text/javascript">
function setColSpan1(){
    var x=document.getElementById('myTable').rows[0].cells
    x[0].colSpan="1"
    x[1].colSpan="37"
}

function setColSpan2(){
    var x=document.getElementById('myTable').rows[0].cells
    x[0].colSpan="19"
    x[1].colSpan="19"
}
</script>
</head>

<body>
<style>
.column {
    font-size: 1pt;
    width: 100%;
    background-color: red;
    padding: 0px;
    margin: 0px;
    margin-bottom: 1px;
    border: 1px solid black;
    height: 10px;
}

.emptycolumn {
    font-size: 1pt;
    width: 100%;
    background-color: blue;
    padding: 0px;
    margin: 0px;
    margin-bottom: 1px;
    border: 1px solid white;
    height: 10px;
}
</style>
<table id="myTable" border="0" cellpadding="0" cellspacing="0" width="100px">
<tr>
    <td colspan="19"><div id="1" class="column" onclick="alert('test');" title="lala test"></div></td>
    <td colspan="19"><div id="2" class="emptycolumn"></div></td>
</tr>
<tr>
    <td colspan="38"><div id="3" class="column"></div></td>
</tr>
<tr>
    <td colspan="1"><div id="4" class="column"></div></td>
    <td colspan="24"><div id="5" class="emptycolumn"></div></td>
    <td colspan="13"><div id="6" class="column"></div></td>
</tr>
</table>

<form>
    <input type="button" onclick="setColSpan1()" value="Change colspan 1">
    <input type="button" onclick="setColSpan2()" value="Change colspan 2">
</form>
</body>

</html>

I started with tests originally of only 6 columns, and that seemed to work perfectly, but increasing my design to 38 has broken this.

Is my design wrong? How can I get this to work accurately? Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:53:57+00:00Added an answer on May 27, 2026 at 12:53 am

    it doesn’t work because the browser can’t calculate correctly width of your columns

    you need to create first row with 38 columns (without colspan), then hide it and in your functions work with next row (1st in your case)

    e.g.:

    document.getElementById('myTable').rows[1].cells
    

    P.S.: id attribute: Specifies a unique id for an element.

    Naming rules:

    Must begin with a letter A-Z or a-z
    Can be followed by: letters (A-Za-z), digits (0-9), hyphens (-), and underscores (_)
    In HTML, all values are case-insensitive

    and specify a DOCTYPE for your document

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.