onmouseover事件调用js控制div中的数据显隐问题 [object].onmouseover = function(){ this.parentNode.style.display = "none";};?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 能不能写的长一点?我觉得数据应该放在div中,但是div中的数据又是怎样一种写法?在页面加载之后那些附件的数据已经存在页面当中了 ,只是需要将该数据显示出来 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><script> function fdiv() { if(document.getElementById("d1").style.display=="none") { document.getElementById("d1").style.display=""; d1.innerText="数据列表";//这里可以换成你从数据里取出来的数据 }else { document.getElementById("d1").style.display="none"; } }</script></head><body><a href="" onmouseover="javascript:fdiv()" onmouseout="fdiv()">把鼠标移上来</a><div id="d1" style="display:none"></div></body></html> 谢谢楼上的,不过我运行了一下,好像代码有错误,把java中的数组或者一个list作为参数传到js中,然后转换为正确的格式好像有点繁琐吧,我只是希望用div来存放数据,然后调用即可,我需要的是在div中存放一个附件列表我更需要的答案是在div中怎么存放数据,div中有table标签吗? 恩,有得,<div id="d1" style="display:none"><table><!--数据--><%ArrayList list=传过来的对象for(int i=0;i<list.length;i++){ out.print("<tr><td>")这样就可以了} %></table></div>阁下是用jsp写的啊,那你c传过来的list就可以在里面遍历 还有如果你希望把鼠标移动到这个层上做数据操作的话,就把我给你写得个onmouseover和onmouseout事件复制到Div标签里就行了也可以把这个div写活,现在这个div是死得,你得数据是活得,如果需要你可以把div写活 现在数据已经可以显示了,但是还有一个问题就是需要把显示出来的附件要在该条数据之上显示出来,就像这个帖子旁边把鼠标放在回帖人的用户名上就会显示出来一些数据,你们看这又应该用什么标签来控制呢?是不是用<ul><li></li></ul>这对标签呢? 可以 什么标签都可以 看你怎么用了!!table都型 我就是一点onmouseover事件之后就会显示出来的结果,可是我该怎样才能有这样的效果?我需要的是效果,不是怎样显示这些数据。 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档 </title> <script> function fdiv() { if(document.getElementById("d1").style.display=="none") { document.getElementById("d1").style.display=""; d1.innerText="数据列表";//这里可以换成你从数据里取出来的数据 }else { document.getElementById("d1").style.display="none"; } } </script> </head> <body> <a href="" onmouseover="fdiv()" onmouseout="fdiv()">把鼠标移上来 </a> <div id="d1" style="display:none"> </div> </body> </html> 楼上的哥们,麻烦你先看完问题再回答吧,我需要的是像csdn旁边回帖用户名把鼠标放上去显示的这种效果,为何你不看问题就把3楼的照搬下来忽悠我啊,不过还是谢了。 <div style="position:absolute;width:200;height:200;border:solid 1px;visibility:hidden" id="popup"></div><img src="<%=p.getImage()=%>" border=0 onmouseover="showimg('<%=p.getImage()%>');" onmouseout="clearimg()"/><script type="text/javascript" language="javascript">function showimg(imgpath){ var x=event.clientX; var y=event.clientY; document.getElementById("popup").innerHTML="<img src='"+imagpath+"' width=200 height=200 />";document.getElementById("popup").style.top=y+50;document.getElementById("popup").style.left=x;document.getElementById("popup").style.visibility="visible";}function clearimg(){ document.getElementById("popup").style.visibility="hidden";}</script> lz不厚道,我虽然看错了题目,但我也不是照搬三楼的啊。谁有空一句一句代码写的啊,能借用就借用一下了。现在借用的是我楼上的兄弟,望楼上兄弟见谅<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>无标题文档</title></head><body><div style="position:fixed;width:200;height:200;border:solid 1px; background:#00CCFF; display:none" id="popup"><img src='http://avatar.profile.csdn.net/F/4/4/2_tujiyue.jpg' width=200 height=200 /><div>ddddddddddddd</div><div>ddddddddddddd</div><div>ddddddddddddd</div><div>ddddddddddddd</div></div><img src="http://avatar.profile.csdn.net/F/4/4/2_tujiyue.jpg" border=0 onmouseover="showimg();" onmouseout="clearimg()"/> <p><span onmouseover="showimg();" onmouseout="clearimg()"><b>搂主</b></span> </p> <img src="http://avatar.profile.csdn.net/F/4/4/2_tujiyue.jpg" border=0 onmouseover="showimg();" onmouseout="clearimg()"/> <p><span onmouseover="showimg();" onmouseout="clearimg()"><b>搂主</b></span> </p> <img src="http://avatar.profile.csdn.net/F/4/4/2_tujiyue.jpg" border=0 onmouseover="showimg();" onmouseout="clearimg()"/> <p><span onmouseover="showimg();" onmouseout="clearimg()"><b>搂主</b></span> </p><script type="text/javascript" language="javascript"> function getXY(Obj) {var sumTop = 0, sumLeft = 0;while(Obj != document.body){sumLeft += Obj.offsetLeft;sumTop += Obj.offsetTop;Obj = Obj.offsetParent;} return {x:sumLeft, y:sumTop};}function showimg() { Objxy = getXY(event.srcElement); document.getElementById("popup").style.top=Objxy.y+event.srcElement.offsetHeight*0.2; document.getElementById("popup").style.left=Objxy.x +event.srcElement.offsetWidth+20; document.getElementById("popup").style.display=""; } function clearimg() { document.getElementById("popup").style.display="none"; } </script></body></html> 纯HTML加JS要怎么调用webservice 挑战www.craigslist.org技术 关于HTC前端校验,多TEXT时,提示错误信息发生死琐的问题 老同志碰到新问题,求高手指点 jquery easyui-tabs,大神指点! 请问这样的效果是如何实现的? iframe的问题?无法引入js谢谢 请帮我看看好吗?谢谢!!!! 一个表单能同时提交给两个页面吗? JS滚动问题,鼠标放上去之后不会滚动了,再拿开也不会滚动 鼠标不能显示 慢慢消失
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script>
function fdiv()
{
if(document.getElementById("d1").style.display=="none")
{
document.getElementById("d1").style.display="";
d1.innerText="数据列表";//这里可以换成你从数据里取出来的数据
}else
{
document.getElementById("d1").style.display="none";
}
}
</script>
</head><body>
<a href="" onmouseover="javascript:fdiv()" onmouseout="fdiv()">把鼠标移上来</a>
<div id="d1" style="display:none"></div>
</body>
</html>
我更需要的答案是在div中怎么存放数据,div中有table标签吗?
<div id="d1" style="display:none">
<table>
<!--数据-->
<%
ArrayList list=传过来的对象
for(int i=0;i<list.length;i++)
{
out.print("<tr><td>")这样就可以了
}
%>
</table>
</div>
阁下是用jsp写的啊,那你c传过来的list就可以在里面遍历
也可以把这个div写活,现在这个div是死得,你得数据是活得,如果需要你可以把div写活
是不是用<ul><li></li></ul>这对标签呢?
看你怎么用了!!table都型
我需要的是效果,不是怎样显示这些数据。
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档 </title>
<script> function fdiv()
{
if(document.getElementById("d1").style.display=="none")
{
document.getElementById("d1").style.display="";
d1.innerText="数据列表";//这里可以换成你从数据里取出来的数据
}else
{
document.getElementById("d1").style.display="none";
}
}
</script>
</head> <body>
<a href="" onmouseover="fdiv()" onmouseout="fdiv()">把鼠标移上来 </a>
<div id="d1" style="display:none"> </div>
</body>
</html>
</div>
<img src="<%=p.getImage()=%>" border=0 onmouseover="showimg('<%=p.getImage()%>');" onmouseout="clearimg()"/>
<script type="text/javascript" language="javascript">
function showimg(imgpath)
{
var x=event.clientX;
var y=event.clientY;
document.getElementById("popup").innerHTML="<img src='"+imagpath+"' width=200 height=200 />";
document.getElementById("popup").style.top=y+50;
document.getElementById("popup").style.left=x;
document.getElementById("popup").style.visibility="visible";
}
function clearimg()
{
document.getElementById("popup").style.visibility="hidden";
}
</script>
谁有空一句一句代码写的啊,能借用就借用一下了。
现在借用的是我楼上的兄弟,望楼上兄弟见谅
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title></head><body>
<div style="position:fixed;width:200;height:200;border:solid 1px; background:#00CCFF; display:none" id="popup"><img src='http://avatar.profile.csdn.net/F/4/4/2_tujiyue.jpg' width=200 height=200 /><div>ddddddddddddd</div><div>ddddddddddddd</div><div>ddddddddddddd</div><div>ddddddddddddd</div></div><img src="http://avatar.profile.csdn.net/F/4/4/2_tujiyue.jpg" border=0 onmouseover="showimg();" onmouseout="clearimg()"/>
<p>
<span onmouseover="showimg();" onmouseout="clearimg()"><b>搂主</b></span>
</p>
<img src="http://avatar.profile.csdn.net/F/4/4/2_tujiyue.jpg" border=0 onmouseover="showimg();" onmouseout="clearimg()"/>
<p>
<span onmouseover="showimg();" onmouseout="clearimg()"><b>搂主</b></span>
</p>
<img src="http://avatar.profile.csdn.net/F/4/4/2_tujiyue.jpg" border=0 onmouseover="showimg();" onmouseout="clearimg()"/>
<p>
<span onmouseover="showimg();" onmouseout="clearimg()"><b>搂主</b></span>
</p>
<script type="text/javascript" language="javascript">
function getXY(Obj) {var sumTop = 0, sumLeft = 0;while(Obj != document.body){sumLeft += Obj.offsetLeft;sumTop += Obj.offsetTop;Obj = Obj.offsetParent;} return {x:sumLeft, y:sumTop};}function showimg()
{
Objxy = getXY(event.srcElement);
document.getElementById("popup").style.top=Objxy.y+event.srcElement.offsetHeight*0.2;
document.getElementById("popup").style.left=Objxy.x +event.srcElement.offsetWidth+20;
document.getElementById("popup").style.display="";
}
function clearimg()
{
document.getElementById("popup").style.display="none";
}
</script>
</body>
</html>