1
<style>
#test{
background-color:#b10515; width=440px;
}
</style>
<script>
...
...
cell[k]=document.createElement('td'); 
var cont = document.createElement('a');
    switch(k){
        case 0:
           cont.innerHTML = jsArray[c].count;
           cell[k].className = 'test';
                break;
    }

Above is my code. In my speculation, cell[k] should have test css style since I set cell[k]

css class as test css. However, test css style was not attached to cell[k] when I run on Tomcat.

can anybody tell me what am I doing wrong with my coding?

1 Answer 1

6

#test is an id selector. You are setting a class. Use .test instead.

You also want : not = in your width rule.

Sign up to request clarification or add additional context in comments.

2 Comments

my bet... I should use : then =.
Use width: 440px; I suggest you take a CSS for beginners course, this will help you make the right selections and understand how the syntax is laid out, htmldog.com/guides/cssbeginner

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.