473,326 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Set bgcolor for a table element dynamically

hi, i need bgcolor through inner html.

in js i wrote like this ,
here document.getElementById(trver).value it display what color i choose.

Expand|Select|Wrap|Line Numbers
  1. var trver="hidd_tr_col" + rowid;
  2.                   alert(document.getElementById(trver).value);
  3.  
  4.                  if(document.getElementById(trver).value!=""){
  5.                    document.getElementById('tr_select').innerHTML=document.getElementById(trver).value; 
  6.                    }else{
  7.                     document.getElementById('tr_select').innerHTML=" ";
  8.                    }
so i pass this bgcolor to one table row
Expand|Select|Wrap|Line Numbers
  1.   <tr align="left" bgcolor="tr_select" valign="top"  id="tr_select">
is it possible to get the corresponding color to this row ..
i need help.

Please enclose your coding with [code] tags when post your codings-Ajaxrand
Jul 2 '07 #1
2 1810
ak1dnar
1,584 Expert 1GB
Moving Thread to Javascript forum –Ajaxrand
From : PHP Forum

Thread title changed – Ajaxrand
Earlier: queries in inner html
Recent: Set bgcolor for a table element dynamically
Jul 2 '07 #2
ronnil
134 Expert 100+
what you want is to set the style of the tr

try this

document.getElementById('your_tr').style.backgroun dColor='#FF0000';
Jul 2 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: A.S. | last post by:
Hi, I have the following simple code: <TABLE><TR> <TD BGCOLOR="#FFFFFF" ONCLICK="myform.color.value = this.bgcolor">hello</TD> </TR></TABLE> <FORM ACTION="hello.cgi" NAME="myform"...
5
by: kj | last post by:
Is there a way to dynamically (e.g. upon onClick) change the bgColor attribute of a table cell? I tried cell.setAttribute("bgColor", someColor), where someColor was a string of the form "#RRGGBB",...
8
by: cool2005 | last post by:
I tried to dynamically add/clone a <tr> from an existing <tr> to a <table> but the problem is that I need to have a "onclick" event handler in the <tr>. I have tried following A. approach...
6
by: Tim Johnson | last post by:
Hello All: Using javascript to dynamically add row elements to a table. as in ..... row.setAttribute("bgcolor",rowColor); // or cell.setAttribute("bgcolor",rowColor); Using firefox or...
15
by: @sh | last post by:
Trying to do this, but its not working...?! My aim being to change the bgcolor of the cell upon which the user has rolled over, I'll then replicate this as an OnMouseOut to change it back. ...
2
by: ezmiller | last post by:
Hi, I have some code (which I will paste in below) that writes out some HTML dynamically using the W3C DOM...the last part of the code write out a simple table. MY problem is that the table is...
7
by: slitvinov | last post by:
I am learning Relax NG. The problem is that I cannot figure out how to make a schema for a table. In my case I would like to make a table with any name of child elements (columns) but columns...
7
by: leiño | last post by:
Hi, i am adding table rows dynamically with javascript. This works fine. The table is inside a div with scrolls, initially with 6 rows: ..... <div style='overflow:auto; width:100%;...
5
by: Don Lancaster | last post by:
I am trying to change a group of background colors by calculating their names in a loop . Names are cfh13, cfh15, cfh17, etc... Unlooped code like cfh17.bgColor="#CCFFFF" ; works just fine....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.