想实现鼠标移动到A区,A区变大,结果...没反应
想问是不是跟冒泡事件有关?(百度了很多也不知道怎么解决)
谢了!
代码如下<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>1</title>
<style type="text/css">
* {
margin:0;
border:0;
}
div {
background-color:yellow;
z-index: -1;
}
#div_0 {
border:black solid 0px;
position:absolute;
left:500px;
top:150px;
text-align:center;
width:400px;
height:400px;
background-color: white;
}
#div_1 {
position:absolute;
left:0;
top:0;
width:150px;
height:240px;
margin:0 10px 10px 0;
} #div_2 {
float:right;
width: 240px;
height:100%;
}
#div_3 {
position:absolute;
left:0;
bottom:0;
width:150px;
height:150px;
}
</style>
</head>
<body>
<div id="div_0">
<div id="div_1" onmouseover="changeSize(this)" onmouseout="recoverSize(this)">A</div>
<div id="div_2">B</div>
<div id="div_3">C</div>
</div>
<script type="text/javascript">
function chageSize(obj){
obj.style.border = "black solid 1px";
obj.style.width = "200px";
obj.style.height = "300px";
obj.style.zIndex = 1;
obj.style.backgroundColor = "green";
}
function recoverSize(obj){
obj.style.border = "";
obj.style.width = "";
obj.style.height = "";
obj.style.backgroundColor = "";
}
</script>
</body></html>
onmouseoveronmouseout
想问是不是跟冒泡事件有关?(百度了很多也不知道怎么解决)
谢了!
代码如下<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>1</title>
<style type="text/css">
* {
margin:0;
border:0;
}
div {
background-color:yellow;
z-index: -1;
}
#div_0 {
border:black solid 0px;
position:absolute;
left:500px;
top:150px;
text-align:center;
width:400px;
height:400px;
background-color: white;
}
#div_1 {
position:absolute;
left:0;
top:0;
width:150px;
height:240px;
margin:0 10px 10px 0;
} #div_2 {
float:right;
width: 240px;
height:100%;
}
#div_3 {
position:absolute;
left:0;
bottom:0;
width:150px;
height:150px;
}
</style>
</head>
<body>
<div id="div_0">
<div id="div_1" onmouseover="changeSize(this)" onmouseout="recoverSize(this)">A</div>
<div id="div_2">B</div>
<div id="div_3">C</div>
</div>
<script type="text/javascript">
function chageSize(obj){
obj.style.border = "black solid 1px";
obj.style.width = "200px";
obj.style.height = "300px";
obj.style.zIndex = 1;
obj.style.backgroundColor = "green";
}
function recoverSize(obj){
obj.style.border = "";
obj.style.width = "";
obj.style.height = "";
obj.style.backgroundColor = "";
}
</script>
</body></html>
onmouseoveronmouseout
解决方案 »
- 这段js怎么还是未定义呢?
- Extjs的datetime控件,有点缺陷请高手修正
- this的一个小小问题
- 请问天猫的这个功能是怎么用js实现的
- 共赏: Very Good 的TabStrip、Menu、TreeView !
- 如何实现这样的特效?有些菜,请帮助!
- 关于Peedy.acs的问题(高手请进),我如何知道他的classid,就是微软的那只绿色鹦鹉
- 怎样撤消在文本框中输入的东西,是什么.undo?
- 在web页面上显示汉字的拼音时,如何显示拼音的声调?(平声、扬声、去声等)
- Javascript怎样实现在本页中自动链接?
- 高分求助函数初始化加载的问题!
- IE10为什么history.back()不起作用呢
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>1</title>
<style type="text/css">
* {
margin:0;
border:0;
}
div {
background-color:yellow;
z-index: -1;
}
#div_0 {
border:black solid 0px;
position:absolute;
left:500px;
top:150px;
text-align:center;
width:400px;
height:400px;
background-color: white;
}
#div_1 {
position:absolute;
left:0;
top:0;
width:150px;
height:240px;
margin:0 10px 10px 0;
} #div_1:hover{
position:absolute;
left:0;
top:0;
width:200px;
height:300px;
margin:10px 10px 10px 0;
border:black solid 1px;
background-color:green;
z-index: 1;
}
#div_2 {
float:right;
width: 240px;
height:100%;
}
#div_3 {
position:absolute;
left:0;
bottom:0;
width:150px;
height:150px;
}
</style>
</head>
<body>
<div id="div_0">
<div id="div_1">A</div>
<div id="div_2">B</div>
<div id="div_3">C</div>
</div>
</body></html>可以直接在样式那里加个hover的伪类
onmouseover="changeSize(this)"
function chageSize(obj) //应该是function changeSize(obj)
onmouseover="changeSize(this)"
function chageSize(obj) //应该是function changeSize(obj)
惭愧!!