Closed Thread Icon

Preserved Topic: table bg (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=18199" title="Pages that link to Preserved Topic: table bg (Page 1 of 1)" rel="nofollow" >Preserved Topic: table bg <span class="small">(Page 1 of 1)</span>\

 
kars10
Bipolar (III) Inmate

From: Europe
Insane since: Mar 2001

posted posted 06-20-2001 05:56

guys, I am tired, exhausted, my eyes are burning and I have this twich under the left eye...
Please, puh-leh-sah(!) tell me how to acces the backgroundcolor of a table?

here is what i am working on:
<table id="zero">
blabla
</table>

<a href="javascript:cb('zero')">change background</a>

--- now, this is my problem:
<script>
function cb(id)
{
document.all.id.style.bgColor=#000000;
}
</script>

-----
I shortened everything, of courze, and it is to be programmed in IE...
1.) do I have to use something else than RGB-coded colors?
2.) am I suppose to insert style? and what is he background colors reference? (As you see, I used bgcolor, as it said in my books)
3.)is it ok, if I only insert id in the reference standing for 'zero'?
[ It should be... 'cuz' it's not saying : document.all.id. is undefined...]
4.)should i use eval like in this: eval("document.all."+id+"style.baclgrooundcolor=#000000")
[5.) would that be the right way? cause this way (and some others) doesn;t work...]

k10

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 06-20-2001 07:57

The script should look like this:

<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
function cb(id) {
&nbsp;&nbsp;&nbsp;&nbsp;document.all[id].style.backgroundColor = "#ff0000";
}
</SCRIPT>

And table should have <TR><TD></TD></TR> elements:

<TABLE ID="zero">
<TR>
&nbsp;&nbsp;&nbsp;&nbsp;<TD>blabla</TD>
</TR>
</TABLE>

kars10
Bipolar (III) Inmate

From: Europe
Insane since: Mar 2001

posted posted 06-21-2001 07:43

hey, it works. thanks max


only change remains

« BackwardsOnwards »

Show Forum Drop Down Menu