473,795 Members | 2,974 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Determine table cell image resides in

Here's what I'm trying to do:

When a user hovers the mouse over an image, I want the background of
the table cell it resides in to change color.

I know how to use the onMouseOver event to detect when the mouse is
hovering over the image, and how to change the background property of
a table cell.

My questions:

How do I address the table cell that contains the image?

Thanks in advance for the help!!!
Jul 23 '05 #1
3 1592
hi,
this should work..

--------------
<TABLE id="Table1">
<TR>
<TD><IMG src="abc.jpg"
onmouseover="th is.parentElemen t.bgColor='blac k';"></TD>
</TR>
</TABLE>
--------------

"midwesthil ls" <mi**********@h otmail.com> wrote in message
news:1f******** *************** ***@posting.goo gle.com...
Here's what I'm trying to do:

When a user hovers the mouse over an image, I want the background of
the table cell it resides in to change color.

I know how to use the onMouseOver event to detect when the mouse is
hovering over the image, and how to change the background property of
a table cell.

My questions:

How do I address the table cell that contains the image?

Thanks in advance for the help!!!

Jul 23 '05 #2
midwesthills wrote:
Here's what I'm trying to do:

When a user hovers the mouse over an image, I want the background of
the table cell it resides in to change color.

I know how to use the onMouseOver event to detect when the mouse is
hovering over the image, and how to change the background property of
a table cell.

My questions:

How do I address the table cell that contains the image?

Thanks in advance for the help!!!

<td onmouseover="so mething()" onmouseout="som ethingElse()">. ........</td>

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #3
On Mon, 20 Sep 2004 23:32:04 +0300, CarettaCare
<ca************ ***@HEREyahoo.c om> wrote:
this should work..

--------------
<TABLE id="Table1">
<TR>
<TD><IMG src="abc.jpg"
onmouseover="th is.parentElemen t.bgColor='blac k';"></TD>
</TR>
</TABLE>
--------------


In Internet Explorer, yes, but in most other browsers it will cause an
error. It would also be better to use the style object (after testing for
it). The bgColor property, along with the bgcolor HTML attribute, is
deprecated in favour of style sheets.

See Randy's post for a simple solution. If the table cell is much larger
than the image, you can check the target/srcElement of the event object
for an image.

[snip]

Mike
Please don't top-post.

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8457
by: Kai Grossjohann | last post by:
I have a table which contains a top-aligned table cell: .... <tr style="height:40"> ... <td colspan="1" rowspan="2" align="left" valign="top" style="overflow:hidden;"> ...contents.explained.later... </td> ...
61
24508
by: Toby Austin | last post by:
I'm trying to replace <table>s with <div>s as much as possible. However, I can't figure out how to do the following… <table> <tr> <td valign="top" width="100%">some data that will 'stretch'</td> <td valign="top" width="300">some data that won't 'stetch'</td> </tr> </table>
3
10888
by: Thomas Mlynarczyk | last post by:
Hello, How can I make an <a> element (containing text only, styled to be a box with a border) as big as the table cell in which it resides, *without* having specified any width/height (neither fixed nor percentage) for this table cell? Sizing the element to 100% width and height does not work, as the parent element's width and height are not specified. And yet, in this case at least, the width and height of the table cell are very...
7
18926
by: Andrew Poulos | last post by:
I'm using the following code to create a small table with one column and two rows. An image goes into the first cell. //create table var t = document.createElement("TABLE"); t.style.position = "absolute"; t.style.left = "100px"; t.style.top = "100px"; t.style.width = "200px";
5
3901
by: Greg N. | last post by:
Hi folks, I have a table cell with a background image, something like <td background=landscape.jpg height=200></td> The sole purpose of this code is to display the image inside that table cell. It displays just as much of the image as the current cell width allows. The actual cell width is determined by other cells in the same table column and by the current browser window width.
5
4894
by: john_williams_800 | last post by:
Hi; I am just starting to use the DOM to do some more advanced javascripting so please be patient with my question if it is an ignorant question. I would like to use the DOM to dynamically create an html table via javascript. While that table is being dynamically created in a javascript function I would like to dynamically insert text and a hyperlink with an image into each cell.
1
3552
by: Thanks | last post by:
I have a routine that is called on Page_Init. It retrieves folder records from a database which I display as Link Buttons in a table cell. I set the table cell's bgcolor to a default color (say black for example). I am dynamically creating the LinkButton controls and adding them into the table cell and I've also hooked up an event handler for each LinkButton's Click event. This all works fine. Now in the Link Button's Click event...
0
1513
by: Thomas Scheiderich | last post by:
I have a table that has 3 image slices. The middle slice changes size based on size of browser window. This works great. My client wants the date to show over the image on the right. So what I did was cut off the top part of the image (which is just a solid color and I can handle by making the background-color of the cell this color). I then use a asp line to display the date, which also works. Here is the original table setup for...
4
2414
by: Bruce | last post by:
I have an asp.net page that is dynamically building a table and populating cells with images (typically jpeg) and with associated metadata. How can the asp.net code efficiently determine the pixel resolution from the image file (without loading the entire image into memory on the server) to allow it to properly size the table cell and its associated Image control? Thanks, Bruce
0
9672
marktang
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10439
Oralloy
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10215
jinu1996
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5437
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.