HighDots Forums  

colore sfondo celle

Javascript (Italian) Il linguaggio JavaScript (it.comp.lang.javascript)


Discuss colore sfondo celle in the Javascript (Italian) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Andrea B.
 
Posts: n/a

Default colore sfondo celle - 02-17-2005 , 06:59 AM






perchè per cambiare lo sfondo a una cella questo nn funziona
si deve usare

cella.setAttribute('bgcolor','#406f9d');

mentre questo[ cella.setAttribute('bgcolor','#406f9d'); ] funziona
solo su Mozilla 1.0 e non su IE6



Grazie

<script type="text/javascript">
function colore_sfondo_celle(){
if(document.getElementById){
cella=document.getElementById("c5");
alert(cella.getAttribute("id"));
//cella.setAttribute('bgcolor','#406f9d');
cella.style.background='#406f9d';
alert('ci arrivo');
}else{
alert('il tuo browser non supporta questa proprietà del DOM W3C');
}
}
</script>


</head>

<body>
<table border="1">
<tr>
<td>cella 0</td>
<td>cella 1</td>
<td>cella 2</td>
</tr>
<tr ID="r3">
<td bgcolor="#999999" ID="c3">cella 3</td>
<td>cella 4</td>
<td ID="c5" width="300">cella 5</td>
</tr>
<tr>
<td>

<input type="button" onClick="colore_sfondo_celle();" value="prova">

</td>
</tr>
</table>

Reply With Quote
  #2  
Old   
Andrea B.
 
Posts: n/a

Default Re: colore sfondo celle - 02-18-2005 , 01:53 AM






Mi rispondo da solo basta utilizzare
cella.setAttribute('bgColor','#406f9d'); e non
cella.setAttribute('bgcolor','#406f9d'); e funziona sia su Mozilla 1.0
che su IE6

bert1977 (AT) libero (DOT) it (Andrea B.) wrote in message news:<65b761c9.0502170359.56a89b9 (AT) posting (DOT) google.com>...
Quote:
perchè per cambiare lo sfondo a una cella questo nn funziona
si deve usare

cella.setAttribute('bgcolor','#406f9d');

mentre questo[ cella.setAttribute('bgcolor','#406f9d'); ] funziona
solo su Mozilla 1.0 e non su IE6



Grazie

script type="text/javascript"
function colore_sfondo_celle(){
if(document.getElementById){
cella=document.getElementById("c5");
alert(cella.getAttribute("id"));
//cella.setAttribute('bgcolor','#406f9d');
cella.style.background='#406f9d';
alert('ci arrivo');
}else{
alert('il tuo browser non supporta questa proprietà del DOM W3C');
}
}
/script


/head

body
table border="1"
tr
td>cella 0</td
td>cella 1</td
td>cella 2</td
/tr
tr ID="r3"
td bgcolor="#999999" ID="c3">cella 3</td
td>cella 4</td
td ID="c5" width="300">cella 5</td
/tr
tr
td

input type="button" onClick="colore_sfondo_celle();" value="prova"

/td
/tr
/table

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.