|
<html>
<head> <title> Test </ title>
<script type = "text / javascript">
function newdiv ()
{
var e = document.getElementById ('test');
e.innerHTML = '';
var d = document.createElement ('div');
d.style.background = 'blue';
d.style.width = '100px';
d.style.height = '100px';
d.onmouseover = EventTest; // Register event handler
var d2 = document.createElement ('div');
d2.style.background = 'green';
d2.style.width = '50px';
d2.style.height = '50px';
d2.style.margin = '25px 25px';
d.appendChild (d2);
e.appendChild (d);
}
function EventTest ()
{
alert ('OK');
}
</ script>
</ head>
<body onload = "newdiv ();">
<div id = "test"> </ div>
</ body>
</ html>
======================================================= ===============
When the mouse enters the blue square, an 'OK' prompt is displayed, which is normal.
When the mouse enters the green square, an "OK" prompt appears, how can I not prompt
When the mouse enters the blue square from the green square, the "OK" prompt appears again. This prompt also wants to be removed.
Purpose: Only when the mouse enters the blue square, a prompt appears. Do not show a prompt on how to move inside the blue square. . . |
|