<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>居中的菜单</title> <script src="js/all.js"></script> <style>
#smallBox
{
width: 98px;
height: 98px;
position: absolute;
border: solid 1px #9af;
filter: alpha(Opacity=50);
opacity: 0.5;
display: block;
background:#aaa;
left:10px;
top:10px;
}
#zoomImage
{
width: 300px;
height: 300px;
position: absolute;
top: 125px;
overflow: hidden;
border: solid 1px #000;
left: 200px;
display: block;
}
</style>
</head>
<body>
<div style="background: #eee; width: 400px; height: 200px; position: relative; left: 100px;
top: 100px; border: solid 1px #000;">
<img src="goodpic/2011-2-212.jpg" onmousemove="document.getElementById('smallBox').innerHTML=event.clientX;">
<div id="smallBox">
a
</div>
</img>
</div>
</body>
</html>鼠标移到框子上,读数不变化,说明mousemove未起作用,设定透明可以,不过除此之外,还有别的办法吗
解决方案 »
- 求一段js,我页面上显示一个图片的名字,aaa.jpg,我鼠标移到aaa.jpg文字上就弹出一个框来显示这张图,鼠标移走就消失,哪位高手有给我下,谢了
- js 如何连接mysql 和oracle?我知道如何连接access
- js的location重定向问题
- 如何动态的创建页内样式?
- 继续帮助———aspx页面的值如何传回ascx页面
- 如何传等号(=)???.....在线
- 简单问题,急
- 求助.一个js的问题
- jquery animate 可以设置哪些动画属性
- 怎样获取input file的value值为绝对路径
- javascript怎么通过外层控制其里面所有元素的属性?
- jquery的validate,当ID为动态时如何写?
你的这一句是鼠标放在图片上才有效果哈 你可以改成
<img src="goodpic/2011-2-212.jpg" onmousemove="alert(1);">
这样效果明显点你看一下有没有效果
<div style="background: #eee; width: 400px; height: 200px; position: relative; left: 100px;
top: 100px; border: solid 1px #000;">
<img src="goodpic/2011-2-212.jpg" onmousemove="document.getElementById('smallBox').innerHTML=event.clientX;">
<div id="smallBox">
a
</div>
</img>
</div>
如果你要在id为smallBox上有效果你就写成
<div style="background: #eee; width: 400px; height: 200px; position: relative; left: 100px;
top: 100px; border: solid 1px #000;">
<img src="goodpic/2011-2-212.jpg">
<div id="smallBox" onmousemove="document.getElementById('smallBox').innerHTML=event.clientX;">
a
</div>
</img>
</div>