wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes link inside another link? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "link inside another link?" Watch "link inside another link?" New topic
Author

link inside another link?

Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Odd question here, but can you put a link inside another link, or a click event on a div where inside the div is also an link in which the inside link takes them to a different action than the outer link or div click event? Isn't that about the event model how browsers work, that a click goes up the dom tree until someone respond to it?

Thanks

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60741
    
  65

Well, you can't embed actual links (<a> elements) within other links. But you can certainly have event handlers at different levels on elements that can be nested. You need to be careful what the inner link is doing as it can prevent the event from propagating upwards in the DOM.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Bear Bibeault wrote:Well, you can't embed actual links (<a> elements) within other links. But you can certainly have event handlers at different levels on elements that can be nested. You need to be careful what the inner link is doing as it can prevent the event from propagating upwards in the DOM.


Cool, so I have to do it without a links and just javascript and events. If the inner is clicked I actually don't want the outer to fire. Basically, it will be a list of users which you can click on any and invite as friends. But inside the user info is their twitter account name that you can click on and it will go to Twitter in another tab/window, so if you click the twitter link, I don't want to send a friend request in that case.

Thanks again for you help.

By the way, in my aboutus (funny us as in just me) I mention you and Eric.

Mark
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Here is a screenshot of the aboutus

Mark


[Thumbnail for aboutus.png]

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60741
    
  65

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: link inside another link?
 
Similar Threads
Can I Hide the Link or Remove the Link ???
Event Handling
Javascript event handler executes twice
(dojo tree) how can I bind an event with the text?
onreadystatechange for div tag