在js中如何实现tip提示的功能,比如,鼠标放在button上,出现一个提示匡,进行提示

green1520 2002-08-28 10:44:09
在js中如何实现tip提示的功能,比如,鼠标放在button上,出现一个提示匡,进行提示
...全文
953 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
meizz 2002-09-07
  • 打赏
  • 举报
回复
<html><head><title>层与按钮对齐</title></head><body>
<div align=left><table border=1>
<tr><td align=center height=50 width=200>
<input type=button value=ok onmouseover="cc(this)" onmouseout="document.all.pop.style.display='none'"></td>
<td align=center height=50 width=200>
<input type=button value=ok onmouseover="cc(this)" onmouseout="document.all.pop.style.display='none'"></td>
<td align=center height=50 width=200>
<input type=button value=ok onmouseover="cc(this)" onmouseout="document.all.pop.style.display='none'"></td></tr>
<tr><td align=center height=50 width=200>
<input type=button value=ok onmouseover="cc(this)" onmouseout="document.all.pop.style.display='none'"></td>
<td align=center height=50 width=200>
<input type=button value=ok onmouseover="cc(this)" onmouseout="document.all.pop.style.display='none'"></td>
<td align=center height=50 width=200>
<input type=button value=ok onmouseover="cc(this)" onmouseout="document.all.pop.style.display='none'"></td></tr>
<tr><td align=center height=50 width=200>
<input type=button value=ok onmouseover="cc(this)" onmouseout="document.all.pop.style.display='none'"></td>
<td align=center height=50 width=200>
<input type=button value=ok onmouseover="cc(this)" onmouseout="document.all.pop.style.display='none'"></td>
<td align=center height=50 width=200>
<input type=button value=ok onmouseover="cc(this)" onmouseout="document.all.pop.style.display='none'"></td></tr>
</table><div>

<div id=pop style="position:absolute;width:100;height:50;z-index:99;display:none">
<table border=0 bgcolor=#FF0000><tr><td align=center>层里文字</td></tr></table></div>

<script language=javascript>
function cc(tt)
{
var daps = document.all.pop.style;
var ttop = tt.offsetTop; //TT控件的定位点高
var thei = tt.clientHeight; //TT控件本身的高
var tleft = tt.offsetLeft; //TT控件的定位点宽
var ttyp = tt.type; //TT控件的类型
while (tt = tt.offsetParent){ttop+=tt.offsetTop; tleft+=tt.offsetLeft;}
daps.top = (ttyp=="image")? ttop+thei : ttop+thei+6; //层的 Y 坐标
daps.left = tleft + 1; //层的 X 坐标
daps.display = ""; //层显示
}
</script>
</body></html>
dylanOK 2002-08-28
  • 打赏
  • 举报
回复
秋水历害呀! ^O^

btw,信誉值如何取得?
qiushuiwuhen 2002-08-28
  • 打赏
  • 举报
回复
Example
The code for the control:

<OBJECT

id=test

type="application/x-oleobject"

classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"

>

</OBJECT>


The JavaScript code to specify the text and font variables:

<script>
FontFace="Verdana,8,,bold"
TopicText="This is an HTML Help pop-up window. This window can display text only."
TopicText2="This is another HTML Help pop-up window."
</script>
The JavaScript code to invoke the control:

<a href="JavaScript:test.TextPopup (TopicText, FontFace, 10,10,10,10)"> TextPopup Example</a>
green1520 2002-08-28
  • 打赏
  • 举报
回复
这个属性的效果不是很好,有没有更好的方法
saucer 2002-08-28
  • 打赏
  • 举报
回复
you can also do
<input type="button" onmouseover="this.title = this.value + ':' + new Date().toString()" value="hello">
meizz 2002-08-28
  • 打赏
  • 举报
回复
<input type=button value=ok title="这是提示文字, 用title这个属性。">
green1520 2002-08-28
  • 打赏
  • 举报
回复
好了
谢谢
还有一个问题,怎么把出现的提示匡去掉
green1520 2002-08-28
  • 打赏
  • 举报
回复
to 秋水无限
好像用不了
oldfisher 2002-08-28
  • 打赏
  • 举报
回复
高!
学习!!!

87,994

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧