给你个例子
<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>
解决方案 »
- 关于排序的问题
- 急》》求一个正则表达式
- eval的疑惑
- js怎么动态取得多个div的值呢?
- js 漂亮的导航菜单
- 3层iframe如何互相访问
- 请问:在javascript的脚本函数里能嵌vbs的代码,vbs也能给javascript变量赋值,javascript能给vbs的变量赋值么?
- 网页中如何直接在网址中输入参数
- JS调用Activex控件带输出参数方法的问题
- 请问如何是弹出的窗口没有关闭的按钮。非最大化状态下
- 关于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希望指点