473,403 Members | 2,354 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,403 software developers and data experts.

Disable tr onclick event...

Hey guys....

i have a really big table... and the <tr> tags have onclick/onmouseover
events that highlight a row when you drag your mouse over it, and open a
popup window when you click anywhere in the row...

if i however have some text in the row that has an href link attached to it,
when i click on the link it will go to the href url AND open the popup
window...

is there any way to stop the popup window from opening when i click a
certain link within a row?
Jul 23 '05 #1
1 2594
On Sun, 29 Aug 2004 17:27:32 GMT, SomeGei <so**@gei.com> wrote:
i have a really big table... and the <tr> tags have onclick/onmouseover
events that highlight a row when you drag your mouse over it, and open a
popup window when you click anywhere in the row...

if i however have some text in the row that has an href link attached to
it, when i click on the link it will go to the href url AND open the
popup window...

is there any way to stop the popup window from opening when i click a
certain link within a row?


Yes, but the approach depends on your environment. If you only care about
recent browsers, you can use the DOM (Document Object Model) to stop the
event propagating up the document tree. However, if you need to support
older browsers, it becomes much less elegant.

New browsers:

<a ... onclick="stopBubble(event);">

function stopBubble(e) {
if(e.stopPropagation) {e.stopPropagation();}
else {e.cancelBubble = true;}
}

See? Simple. :)

Old browsers:

<tr ... onclick="myFunction(event);">

<!-- Notice the difference in the call! -->

/* This is your pop-up code. */
function myFunction(e) {
var l = document.links,
i = l.length,
t = e.target || e.srcElement;

/* Search to see if the target element
* was a link. If it was, quit. */
while(i--) {if(l[i] == t) {return;}}

/* Rest of your function. */
}

By the way, I don't know how well the latter will work. It should be fine,
but I haven't tested it.

Good luck,
Mike

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

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

Similar topics

4
by: KS | last post by:
Im trying to prevent the user from clicking any other links on my page when the user have selected/clicked a href once. Sometimes it takes a while before the next page loads so some user will try...
1
by: MEM | last post by:
hello, I'd like to 'disable' an image link based on a value selected in a drop down. I currently have an image link that has the onclick event set to execute a function. For example:
2
by: Barton | last post by:
Hello, I've got a table row with an onClick event that loads page1. Now I do not want to apply this event to one cell of that row because that cell contains already a link to another page. How...
6
by: Al Cohen | last post by:
I'm using a LinkButton to call some code, then do a redirect. The code does some queries, sends some emails, and takes a few moments before the redirect is performed. I'd like to disable my...
3
by: Jeff | last post by:
I have a payment form with a submit button. A large percentage of users double-click the submit button thus submitting their payment information twice. I would like to use javascript to disable...
4
by: Arvind P Rangan | last post by:
Hi, Has anybody worked on disabling postback event of button event in webforms. As it does not have a property of autopostback how do we make it disable. I tried few article but they have...
4
by: Chris | last post by:
I have an asp.net page say page1.aspx. The form in html code is <form id = "Form1"> And i want to disable all the fields of the form after some code steps. I had created a javascript funct: ...
17
by: dan_williams | last post by:
I have the following test web page:- <html> <head><title>Test</title> <script language="Javascript"> <!-- function fnTR() { alert("TR"); }
5
by: Geoff Cox | last post by:
Hello I have for example <IMG alt="image" id="IMG1" src="../images/play1.gif" onClick="getSound(this);"> Can I disable this (stop onlick from working) until another action has been...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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,...
0
isladogs
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...

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.