click on link triggers click on cell

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
sarris
Forum Contributor
Posts: 137
Joined: Mon Dec 04, 2006 2:44 pm

click on link triggers click on cell

Post by sarris »

Hi there...I have a table which is clickable and executes a function

Code: Select all

var myfnc3 = "mouseclick_table("+id+")";
house.setAttribute("onclick",myfnc3);

function mouseclick_table(id){
	table = document.getElementById(id);
	table.setAttribute("border" ,"1");
	table.setAttribute("bordercolor","#003366");
}
works ok...
in that table, in one cell i have a link

Code: Select all

<a href = "javascript: somefunction()">
of course when i click that link the mouseclick_table triggers as well...how can i make it so when i click on that certain link, the onclick function of the table doesnt execute?

thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Cancel the bubble.
sarris
Forum Contributor
Posts: 137
Joined: Mon Dec 04, 2006 2:44 pm

Post by sarris »

ok...so i added

Code: Select all

window.event.cancelBubble = true;
into somefunction()...
still triggers both.

ps: i am using mozzila
sarris
Forum Contributor
Posts: 137
Joined: Mon Dec 04, 2006 2:44 pm

Post by sarris »

anyones knows? am i using the cancel bubble wrongly???
Post Reply