C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






Event Bubbling in Javascript


Posted Date: 10 Sep 2008    Resource Type: Code Snippets    Category: Javascript
Author: Shanthi MMember Level: Gold    
Rating: Points: 10



Event Bubbling is the process whereby events fired in child elements "bubble" up to their parent elements. When a child event is fired, the event is first delivered to the child's event handler, then to the parent's event handler.

The following code snippet shows how to bubble the child event into parent event using Javascript.


//Paste the code into script tag
function documentClick()
{
alert("You clicked in the document");
}
function paragraphClick(value)
{
alert("You clicked the text");
if(value)
event.cancelBubble=true;
}
document.onclick=documentClick;

// Paste the code into paragraph tag
onclick="paragraphClick(false)"

//Paste the code into another paragraph tag
onclick="paragraphClick(true)"




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Javascript  .  Event Bubbling  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Error Handling in Javascript
Previous Resource: How to get browser information using Javascript
Return to Discussion Resource Index
Post New Resource
Category: Javascript


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use