给你个例子
<script>
function show(o)
{showInfo.innerHTML=o.innerHTML;
}
function hid()
{showInfo.innerHTML="";
}
</script>
<span onmouseover="show(this)" onmouseout="hid()">text1</span>
<span onmouseover="show(this)" onmouseout="hid()">text2</span>
<span onmouseover="show(this)" onmouseout="hid()">text3</span>
<span onmouseover="show(this)" onmouseout="hid()">text4</span>
<span onmouseover="show(this)" onmouseout="hid()">text5</span>
<div id="showInfo"></div><span onmouseover="show(this)" onmouseout="hid()">text1</span>
<span onmouseover="show(this)" onmouseout="hid()">text2</span>
<span onmouseover="show(this)" onmouseout="hid()">text3</span>
<span onmouseover="show(this)" onmouseout="hid()">text4</span>
<span onmouseover="show(this)" onmouseout="hid()">text5</span>
<div id="showInfo"></div>
<script>
function show(o)
{showInfo.innerHTML=o.innerHTML;
}
function hid()
{showInfo.innerHTML="";
}
</script>
<span onmouseover="show(this)" onmouseout="hid()">text1</span>
<span onmouseover="show(this)" onmouseout="hid()">text2</span>
<span onmouseover="show(this)" onmouseout="hid()">text3</span>
<span onmouseover="show(this)" onmouseout="hid()">text4</span>
<span onmouseover="show(this)" onmouseout="hid()">text5</span>
<div id="showInfo"></div><span onmouseover="show(this)" onmouseout="hid()">text1</span>
<span onmouseover="show(this)" onmouseout="hid()">text2</span>
<span onmouseover="show(this)" onmouseout="hid()">text3</span>
<span onmouseover="show(this)" onmouseout="hid()">text4</span>
<span onmouseover="show(this)" onmouseout="hid()">text5</span>
<div id="showInfo"></div>
解决方案 »
- fullscreen=yes 全屏
- 【各位专家们,还有一个初级问题要大家帮忙,用dom动态添加表行】
- js写法问题
- 如何在网页的左边框架里面加入树型目录
- 如何更改一个label的内容?
- 请教javascript高手,我初次接触javascript,这个代码是书上的,为什么执行不了
- 血本求解:如何在java中注册到 javascript: window.external.MyMethod.的MyMethod 方法?谢谢
- 这个方法搞不清。
- 在Netscape中显示时钟?
- 求JavaScript代码一段
- 关于document.getElementById这个函数的用法
- 主页面是一个框架,在左边框架中单吉按钮后弹出一个子窗体,怎么样才能在子窗体关闭的时候,让整个主框架重新定位到一个地址啊?
<html><head><title>层与按钮对齐</title></head><body>
<div align=left><table border=1 width=600 height=50>
<tr align=center>
<td>
<input type=button value=ok onmouseover="cc(this)" alt="提示信息一"
onmouseout="document.all.pop.style.display='none'">
</td><td>
<input type=button value=ok onmouseover="cc(this)" alt="提示信息二"
onmouseout="document.all.pop.style.display='none'">
</td><td>
<input type=button value=ok onmouseover="cc(this)" alt="提示信息三"
onmouseout="document.all.pop.style.display='none'">
</td></tr>
</table><div><div id=pop style="
position: absolute;
width: 120;
height: 30;
z-index: 99;
display: none;
background-color: #FF0000"
>
图层文字</div><script language=javascript>
function cc(tt)
{
var e = document.getElementById("pop");
var t = tt.offsetTop; //TT控件的定位点高
var h = tt.clientHeight; //TT控件本身的高
var l = tt.offsetLeft; //TT控件的定位点宽
var ttyp = tt.type; //TT控件的类型
while (tt = tt.offsetParent){t += tt.offsetTop; l += tt.offsetLeft;}
e.style.top = (ttyp=="image")? t + h : t + h + 6; //层的 Y 坐标
e.style.left = l + 1; //层的 X 坐标
e.style.display = "block"; //层显示
e.innerText = window.event.srcElement.alt;
}
</script>
</body></html>
<script language="javascript">
function show_text(id){
document.all.t1.value=id.innerText
}
</script>
<textarea id="link" onmouseover="show_text(link)">dfasdfasdfa</textarea>
function show(o)
{showInfo.innerHTML=o.innerHTML;
}
function hid()
{showInfo.innerHTML="";
}
</script>
<span onmouseover="show(this)" onmouseout="hid()">text1</span>
<span onmouseover="show(this)" onmouseout="hid()">text2</span>
<span onmouseover="show(this)" onmouseout="hid()">text3</span>
<span onmouseover="show(this)" onmouseout="hid()">text4</span>
<span onmouseover="show(this)" onmouseout="hid()">text5</span>
<div id="showInfo"></div>可以显示不同内容,但是内容的话可以自己控制,显示内容不是点击文字的内容,
而是另外一个可以自己单独控制的地方
请问如何做呢?
<html><head><title>文字不同显示</title></head><body>
<div align=left><table border=1 width=600 height=50>
<tr align=center>
<td>
<input type=button value=ok onmouseover="cc(pop)" alt="提示信息一"
onmouseout="document.all.pop1.style.display='none'">
</td><td>
<input type=button value=ok onmouseover="cc(pop2)" alt="提示信息二"
onmouseout="document.all.pop2.style.display='none'">
</td><td>
<input type=button value=ok onmouseover="cc(pop3)" alt="提示信息三"
onmouseout="document.all.pop3.style.display='none'">
</td></tr>
</table><div>
<div id=pop style="position: absolute; width: 174px; height: 82px; z-index: 99; display: none; background-color: #FF0000; left: 535px; top: 73px;"
> 图层文字fdsfasds</div>
<div id=pop2 style="position: absolute; width: 174px; height: 82px; z-index: 99; display: none; background-color: #FF0000; left: 535px; top: 73px;"
> 图层文字fdsafdsfds</div>
<div id=pop3 style="position: absolute; width: 174px; height: 82px; z-index: 99; display: none; background-color: #FF0000; left: 535px; top: 73px;"
> 图层文字sdfasdfas</div>
<script language=javascript>
function cc(tt)
{
var e = document.getElementById(tt);
e.style.top = 73; //层的 Y 坐标
e.style.left = 535; //层的 X 坐标
e.style.display = "block"; //层显示
e.innerText = tt.innerText
}
</script>
</body></html>
这里不能按照要求显示,主要是,参数的传和取我不知道怎么做
比如pop2.innerText 怎么把参数传到cc() 中的e.innerText希望指点