onmouseover没有反应,控制台没有检测到语法错误,不知道问题在哪里
你把页面效果截图,看看是不是你的文字被div遮住,以下运行可以
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
#thread2,
#thread4 {
width: 300px;
height: 300px;
background-color: red;
position: absolute;
}
</style>
</head>
<body>
<ul style="list-style-type: none">
<ol>
<div class="css1">
<div class="css2"><a id="thread1" href="">新闻</a></div>
<div class="css3"><a id="thread3" href="">娱乐</a></div>
</div>
</ol>
<ol>
<div id="thread2"></div>
<div id="thread4"></div>
</ol>
</ul>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
$(document).ready(function () {
$("#thread1").mouseover(function () {
$("#thread2").css("background-color", "orange").css("z-index", "999");
});
$("#thread1").mouseout(function () {
$("#thread2").css("background-color", "red").css("z-index", "1");
});
});
</script>
</body>
</html>