473,781 Members | 2,280 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

onCLick on TD only works on image inside TD

I have an onClick on a TD. If I click on an image inside the TD, the
onClick fires, however if i click anywhere else inside the TD nothing
happens.

Any ideas?
Jul 23 '05 #1
2 2119
TnaG wrote:
I have an onClick on a TD. If I click on an image inside the TD, the
onClick fires, however if i click anywhere else inside the TD nothing
happens.

Any ideas?


<table>
<tr>
<td onclick="alert( 'hi');"><img src="about:blan k"><span>Som e
text</span></td>
</tr>
</table>

Tested and working here. If you click "Some text" in IE6SP1, Firefox
0.9.2 and Opera 7.52, the alert() appears.

Perhaps you could provide a URL or the smallest amount of code that
demonstrates this problem. Describe what browsers it is failing in and
what, if any, errors are occurring in those browsers.

Sometimes just breaking the problem down into the smallest reproducible
amount of HTML and Javascript reveals the source of the problem. For
example, you may have a DIV or other element on top of the table cell,
and the only part of the table cell actually exposed to the mouse is the
image.

--
Grant Wagner <gw*****@agrico reunited.com>
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #2
TnaG wrote:
I have an onClick on a TD. If I click on an image inside the TD, the
onClick fires, however if i click anywhere else inside the TD nothing
happens.

Any ideas?


Any source code? What user agent(s) have you tested with?
PointedEars
Jul 23 '05 #3

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

Similar topics

2
4445
by: Rob Manger | last post by:
Hi All, I am hoping someone can help me. I am trying to setup my main page so that when the user moves the mouse over an image, it changes the source (got this working). When the user CLICKS on the image (it is a link to the content page) it changes to a third image AND STAYS THERE. ie: so the iamge won't change back to the omouseoff image. Does this make sense? Also, how do I "preload" the images before they are even needed? eg:...
6
9943
by: Cockroach | last post by:
Hello, I have a problem where the onClick of a table row will activates a window.location event, and inside a cell in that row, an image onClick event shows/hides a div. The problem is that when you click on the image, it briefly shows the div, and then reloads the page to the window.location url. Is there a way of preventing the onClick of the row (<tr>) from doing
0
3178
by: Diane Yocom | last post by:
I'm very new to ASP.Net and probably jumped in a little over my head, but... I'm trying to create a user control that will control navigation through my site. It's sortof like Amazon.com, where there are tabs at the top with "submenu" buttons showing below the selected tab. The data that defines the tabs and submenus is stored in an XML file and I'm using nested repeaters to build them dynamically. I've got it working pretty well, except...
7
1546
by: Tim::.. | last post by:
Can someone please tell me how i execute an onClick event in an asp:Image tag! I want to do the following! Thanks! <asp:Image runat="server" ID="ibtnExpandResource" ImageUrl="../images/user.gif" onClick="Javascript: OnPlusClick(this);" style="cursor:hand;"></asp:Image>
3
3713
by: Siah | last post by:
Hi, I have table with many rows indicating my record. I want my rows to load my record, so I attached an onClick event to every row that loads the proper record. Now, there are options associated to every record (delete link, select checkbox, etc) that don't result in loading the record. The problem should be obvious, upon the user clicking on any of those options, the row's onclick is triggered which is undesirable behaviour.
11
3033
by: GaryB | last post by:
Hi Guys, I've been battling with this one for hours - I hope that you can help me! My code modifies the <aon a page, from a standard document link into a link with a tailored onclick event. It works perfectly (assigning the correct images and the correct onclick events to the correct <atags):
1
386
by: webdeveloper | last post by:
An onclick event that activates two functions: one that expands a menu, another that swaps an image in the same menu hierarchy; in FF, only one click is required to both swap the image and expand the menu, as is intended. But in IE(6X) one click is required for swapping the image, and a second click to expand the menu. And in IE, on all subsequent clicks, just one click is required for both functions to fire, but the result is that the...
2
5399
by: Miroslav Stampar [MCSD.NET / Security+] | last post by:
Does anybody have an idea how to call CGI on a onclick event when link is clicked. This is a sample that works in some situations but sometimes new page loading is to fast. <a href="http://www.google.com" onclick="new Image().src=\'http:// www.example.com/process.cgi?p=1\'"> Plz help :)
1
4085
by: sourcie | last post by:
I am changing an existing quiz found on "JavaScriptKit.com Multiple Choice Quiz" I have an image. Instead of using the radio buttons with the normal true/false question, I want to place two hotspots on the image. One being correct(a) and the other incorrect(b). When the user clicks on the correct hotspot or place on the image, it should score and retain that value until the end of the quiz. At the end of the quiz, there is a submit button...
0
10306
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...
1
10075
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
9931
tracyyun
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8961
agi2029
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6727
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
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...
1
4037
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
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.