If <p> is in <div>, then <p> There is an OnClick event, and <div> also onCLICK incident. In order to trigger the <p> clicks, the clicks of the parent element do not trigger, then you need to need Call the following function:
Copy code code as follows:
Function StopBubble (E) {
if (E && E.StopPropagation) {// Non -IE
e.stoppropagation ();
}
else {// iee
Window.event.cancelbubble = true;
}
}
<A onClick = ''> If you want to prevent the trigger of the default event, that is, the default HREF event, then you need to call the following function:
Copy code code as follows:
Function Stopdefault (E) {
// Prevent default browser action (W3C)
if (E && E.PreventDefault)
e.Preventdefault ();
// In IE, the way to prevent the function from the default action of the function
else
window.event.returnValue = false;
Return false;
}