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

  • Home
  • SEARCH
  • 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 5844733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:20:05+00:00 2026-05-22T12:20:05+00:00

I am trying to create a table width javascript and createElement(). My problem is

  • 0

I am trying to create a table width javascript and createElement().
My problem is that it does not set any background image (just plain white).
However, if I set the innerHTML of the to an image tag with same path, it works!

create : function () {
    var tbody = document.createElement('tbody');
    for(i in this.map) {
        var tr = document.createElement('tr');
        for(j in this.map[i]) {
            var td = document.createElement('td');
            var cell = this.map[i][j];
            td.style.color = "red";
            console.log("gfx/tile_"+this.backgrounds[cell]+".png");
            td.style.backgroundImage = "url(gfx/tile_"+this.backgrounds[cell]+".png);";
            td.innerHTML = "j";
            tr.appendChild(td);
        }
        tbody.appendChild(tr);
    }
    this.gameDOMelm.appendChild(tbody);
}

I also have another problem that there’s space between each ROW in the table.
Here’s the DOM Element I’m appending to:

<table id="gameField" cellpadding="0" cellspacing="0"></table>

And the CSS

    * {padding: 0; margin: 0;}
    td {
        min-width: 32px;
        min-height: 32px;
        width: 32px;
        height: 32px;
    }

These problems occur both in Chrome and FF @ ubuntu 11.04.
No errors shows in javascript console.

  • jack
  • 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-22T12:20:06+00:00Added an answer on May 22, 2026 at 12:20 pm

    Try "url('gfx/tile_"+this.backgrounds[cell]+".png')" (with single quotes around the URL).

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

Sidebar

Related Questions

I'm trying to create a Users table that only has OpenId registrations, exactly like
I am trying to create a column in a table that's a foreign key,
I am trying to create a table with the following: CREATE TABLE GTW_WORKFLOW_MON (
I'm trying to create a table with two columns comprising the primary key in
Using Prototype 1.6's new Element(...) I am trying to create a <table> element with
I'm trying to create and retrieve a BLOB in a MySQL table via Kohana's
I'm trying to create a jqgrid, but the table is empty. The table renders,
I am trying create a WCF service that leverages the WPF MediaPlayer on the
I've created a Javascript object via prototyping. I'm trying to render a table dynamically.
I'm trying to create a SVG filter that would create an Anaglyph effect. What

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.