同一个页面有2个div,如何在一个div中触发事件,在另一个div显示结果??

<div id="hello">
<a href="......"
onmouseover="document.all.hey.style.display='none'"
onmousedown="document.all.hey.style.display='block'" >
你好
</a>
</div>
<div id="hey"></div>
请大侠们帮忙补充一些代码,非常感谢!!!

第1个回答  2010-09-15
<!-- 请将这里所有的代码Copy到新建文本文档中,然后将后缀名改成.htm运行 -->
<html>
<head>
<title>隐藏和显示层</title>
<script language="javascript">
function Hid_ShowDIV()
{
document.getElementById("div_1").style.display="none";
document.getElementById("div_2").innerHTML = "Hello World(点这里再变回去)";
}
function Hid_ShowDIV2()
{
document.getElementById("div_1").style.display="block";
document.getElementById("div_2").innerHTML = "这里是第一个层,在这里点击鼠标,将本层隐藏,将第二个层文字修改为Hello World";
document.getElementById("div_2").innerHTML = "这里是第二个层";
}
</script>
</head>
<body>
<div id="div_1" onclick="Hid_ShowDIV()" style="border:1px black solid">这里是第一个层,在这里点击鼠标,将本层隐藏,将第二个层文字修改为Hello World</div>
<div id="div_2" onclick="Hid_ShowDIV2()" style="border:1px blue solid">这里是第二个层</div><br/>
</body>
</html>
第2个回答  2010-09-15
要点击后把“你好”放在 hey的DIV里吗?

============

你看看是不是这个效果

<script type="text/javascript">
function showhey(){
document.getElementById("hey").style.display = "block";
document.getElementById("hey").innerHTML = document.getElementById("v").innerHTML;
}
</script>
<div id="hello">
<a id="v" href="#" onclick="showhey()" >你好</a>
</div>
<div id="hey" style="display:none"></div>本回答被提问者采纳
第3个回答  2010-09-15
你不都会了么。。。 隐藏显示
相似回答