Hi,
When clicked into any cell of the table, i want to get the background color
of it. I can get the forecolor but not the bakground color (gives an empty
Alert, no error).
I think i can't change anything in the code-behind, so the error will be in
the javascript code ...
Thanks for your help
Bob
the aspx file:
-----------
<asp:Table ID="table1" runat="server"> </asp:Table>
<script language="javas cript" type="text/javascript">
function tableclick(even t)
{
forecl=window.e vent.srcElement .style.color
// this works
backcl=window.e vent.srcElement .style.backgrou nd //
this not
alert(forecl)
alert(backcl)}
}
the code-behind:
----------------
'creattion of the cells in the table
Dim r As TableRow
Dim c(50, 20) As TableCell
For i = 0 To 50
r = New TableRow()
For j = 0 To 20
c(i, j) = New TableCell()
r.Cells.Add(c(i , j))
Next
Table1.Rows.Add (r)
Next
....
//e.g. the back/forecolor of cell 3,2:
c(3, 2).BackColor = System.Drawing. ColorTranslator .FromHtml("red" )
c(3, 2).ForeColor = System.Drawing. ColorTranslator .FromHtml("yell ow")
//c(3, 2).BackColor = Drawing.Color.R ed
// tried also with this method
.... 4 1814
"Bob" <sd*@sdvsd.dc > wrote in
news:ud******** ******@TK2MSFTN GP02.phx.gbl: When clicked into any cell of the table, i want to get the background color of it. I can get the forecolor but not the bakground color (gives an empty Alert, no error). I think i can't change anything in the code-behind, so the error will be in the javascript code ...
It's not possible to read the default style properties of a DOM element.
They'll always return 'undefined' or whatever passes for that in
JavaScript.
--
Klaus H. Probst, MVP http://www.simulplex.net/
Thanks, but then, how do you explain it works with the forecolor?
There must be a way to do the same with the background ...
"Klaus H. Probst" <us*******@simu lplex.net> wrote in message
news:Xn******** *************** ***********@207 .46.248.16... "Bob" <sd*@sdvsd.dc > wrote in news:ud******** ******@TK2MSFTN GP02.phx.gbl:
When clicked into any cell of the table, i want to get the background color of it. I can get the forecolor but not the bakground color (gives an empty Alert, no error). I think i can't change anything in the code-behind, so the error will be in the javascript code ...
It's not possible to read the default style properties of a DOM element. They'll always return 'undefined' or whatever passes for that in JavaScript.
-- Klaus H. Probst, MVP http://www.simulplex.net/
Bob said the following on 6/17/2006 4:59 AM: Hi,
When clicked into any cell of the table, i want to get the background color of it. I can get the forecolor but not the bakground color (gives an empty Alert, no error). I think i can't change anything in the code-behind, so the error will be in the javascript code ...
<snip>
backcl=window.e vent.srcElement .style.backgrou nd //
window.event.sr cElement.style. backgroundColor ;
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
thanks
"Randy Webb" <Hi************ @aol.com> wrote in message
news:DJ******** *************** *******@comcast .com... Bob said the following on 6/17/2006 4:59 AM: Hi,
When clicked into any cell of the table, i want to get the background
color of it. I can get the forecolor but not the bakground color (gives an
empty Alert, no error). I think i can't change anything in the code-behind, so the error will be
in the javascript code ...
<snip>
backcl=window.e vent.srcElement .style.backgrou nd //
window.event.sr cElement.style. backgroundColor ;
-- Randy comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: erik |
last post by:
Is it posssible to inherit the previous pages (parent pages)
background image? Is there a script out there I could look at? Thanks
|
by: Nathan Given |
last post by:
Hello All,
I am trying to randomly change the background image of my home page
but I can't seem to figure it out.
Here is a snippet of my css
....
BODY {background:transparent url(../images/homepagebg3.jpg) no-repeat;
font:normal 90% Arial, Helvetica, sans-serif; color:#263158;}
|
by: Konrad Den Ende |
last post by:
I have a function returning a string but the problem is that the
color of it is blue which suits me well for some pages but not for
others. Is it possible to "feel" what the color of the background
in the current document is and set the color of the output accordingly? The
background will be an image, in most cases.
--
Kindly
Konrad
|
by: Peter Williams |
last post by:
Hi All,
I want to write some javascript for a html page which does the
following.
Imagine that the page contains a table with 2 columns and 3 rows, e.g.:
+---+---+
| A | B |
+---+---+
|
by: rkbnair |
last post by:
I have an image placed on an aspx page.
<img id="xyz" onMouseOver="abc()" src="c:\temp\ijk.jpg"> My Text to Display
How can I change the forecolor of the text 'My Text to display' in function
abc()?
Either in java or c#
| |
by: Tom John |
last post by:
Hi
I have a ListView that i want to be able to modify the color of
particular items depending on whether the value of the item they are
about to be replaced with is higher, lower or the same:
With QueueListItem.SubItems(ItemCount)
If .Text = DataRow.Item(ItemCount) Then
.ForeColor = Color.Black
ElseIf .Text < DataRow.Item(ItemCount) Then
|
by: Bernie Yaeger |
last post by:
When you use xp styles
Application.EnableVisualStyles()
Application.DoEvents()
and you change a control's flat style to 'system', you then are not able to
set the control's forecolor, or if you did set it, it reverts to the default
|
by: Stephen |
last post by:
greeting folks
I would like to change the foreground color for a disabled textbox from the
dimmed gray to something else that is easlier readable. I can change the
background using the following:
textbox1.BackColor = System.Drawing.SystemColors.Control.White
however i cant for the life of me figure out the foreground . any help would
be...
|
by: moondaddy |
last post by:
in asp.net 2.0, i have a link buttonand want to change the forecolor in a
mouse over event. how can I do this?
--
moondaddy@noemail.noemail
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |