| |

VerySource

 Forgot password?
 Register
Search
View: 739|Reply: 4

Js incident problem?

[Copy link]

2

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-2-6 22:30:01
| Show all posts |Read mode
<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. . .
Reply

Use magic Report

0

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-3-29 11:30:02
| Show all posts
The mouse over an element in a certain area will also trigger the onmouseover event. You can add a setTimeout to the onmouseover event. When the mouse is truly drawn from another element into this area, the function is triggered. The function is not run if an event inside the block is triggered.
Reply

Use magic Report

0

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-3-31 00:00:01
| Show all posts
onmouseenter
Reply

Use magic Report

2

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-7-13 17:00:01
| Show all posts
What, the new incident that came?
Is there any source document to view?
Reply

Use magic Report

2

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-7-13 19:30:01
| Show all posts
Changed the trigger event, it immediately refreshed, thank you
Also thank other friends who provide help~
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list