谁能帮我实现这样的效果,可能比较简单!!!!!!!!

comnetorgcn 2003-07-01 04:55:21
表格的内容动态从数据库中取出,要实现:

默认只显示表格中的前8个字符,当鼠标指到单元格时,用一个小的浮动窗口显示全部内容,且浮动窗口的位置随鼠标的位置而定。鼠标离开后,窗口自动消失

谁能提供点线索,最好能有可参考的代码,或者提供已实现此功能的网页也行,谢谢
...全文
57 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
comnetorgcn 2003-07-01
  • 打赏
  • 举报
回复
多谢,结帐
gq 2003-07-01
  • 打赏
  • 举报
回复
<span title="悬停文字">文字</span>
<span title="悬停 文字">文字</span>
<a href="http://www.163.com" title="网易搜索引擎 要加分哟!">网易</a>
*****************************************************************************
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
</head>
<body>

<select onmouseout="hideTitle()" style="width:100" onmousemove="showTitle()">
<option>aaaaaaaaaaaaaaaaaaaaaaaaaaa</option>
<option>bbbbbbbbbbbbbbbbbbbbbbbbbbb</option>
<option>ccccccccccccccccccccccccccc</option>
</select>
<select onmouseout="hideTitle()" style="width:100" onmousemove="showTitle()">
<option>111111111111111111111111</option>
<option>22222222222222222222222</option>
<option>33333333333333333333333333</option>
</select>

<span style="display:none;position:absolute;background-color=#F8F9DF;" id=titleSpan></span>
<SCRIPT LANGUAGE="JavaScript">
<!--
function showTitle()
{
var elm = event.srcElement;
titleSpan.innerText = elm.options[elm.selectedIndex].text;
titleSpan.style.top=event.y+20
titleSpan.style.left=event.x+20
titleSpan.style.display="";
}
function hideTitle()
{
titleSpan.style.display="none";
}
//-->
</SCRIPT>
</body>
</html>
*****************************************************************
<script>
var thefont
var i=0,j=0
var thefonts=new Array()
function showit(obj){
thefont=obj
e=event.srcElement
t=e.offsetTop;
l=e.offsetLeft;
while(e=e.offsetParent){
t+=e.offsetTop;
l+=e.offsetLeft;}
tips.style.display=""
tips.style.left=l+event.srcElement.offsetWidth
tips.style.top=t+event.srcElement.offsetHeight
expan()
}
function hideit(){
tips.style.display="none"
tips.style.width=0
tips.style.height=0
tips.innerHTML=""
i=0
j=0
}
function showmessage(){
thefonts=thefont.split("")
addfont()
}
function addfont(){
if(j<thefonts.length){
tips.innerHTML="<font color=black>"+tips.innerText+"</font><font color=white>"+thefonts[j]+"</font>"
setTimeout("addfont()",50)
}
j++
}
function expan(objs){
if(i<150){
tips.style.width=i*2
tips.style.height=i*1
setTimeout("expan()",10)
}
else
if(i==150)
showmessage()
i++
}
</script>
<style type=text/css>
a {font-size:14px;color:#666666;font-family:"tahoma";text-decoration: none}
span{font-size:12px;color:black;font-family:Verdana;border:1 solid gray}
</style>
<a href="#" onmouseover="showit('123 123 123 123 123 123 123 123 123 12a3 123 123 123 123 123 123.')" onmouseout=hideit()>123</a>
<span id=tips style="position:absolute;width:0px;height:0px;background:#cccccc;display:none;filter: Alpha(opacity=60)"></span>


gq 2003-07-01
  • 打赏
  • 举报
回复
给你个些代码自己研究。
<script>
tPopWait=50;tPopShow=7000;showPopStep=2;popOpacity=99;sPop=null;curShow=null;tFadeOut=null;tFadeIn=null;tFadeWaiting=null;
document.write("<style type='text/css'id='defaultPopStyle'>");
document.write(".cPopText { background-color: #e8f4ff;color:#000000; border: 1px #0099cc solid;font-color: font-size: 12px; padding-right: 4px; padding-left: 4px; height: 20px; padding-top: 2px; padding-bottom: 2px; filter: Alpha(Opacity=0)}");
document.write("</style>");
document.write("<div id='dypopLayer' style='position:absolute;z-index:1000;' class='cPopText'></div>");
function showPopupText(){
var o=event.srcElement;MouseX=event.x;MouseY=event.y;
if(o.alt!=null && o.alt!=""){
o.dypop=o.alt;o.alt=""
};
if(o.title!=null && o.title!=""){
o.dypop=o.title;o.title=""
};
if(o.dypop!=sPop){
sPop=o.dypop;
clearTimeout(curShow);
clearTimeout(tFadeOut);
clearTimeout(tFadeIn);
clearTimeout(tFadeWaiting);
if(sPop==null || sPop==""){
dypopLayer.innerHTML="";
dypopLayer.style.filter="Alpha()";
dypopLayer.filters.Alpha.opacity=0;
}
else {
if(o.dyclass!=null) popStyle=o.dyclass
else
popStyle="cPopText";
curShow=setTimeout("showIt()",tPopWait);
}
}
}
function showIt(){
dypopLayer.className=popStyle;
dypopLayer.innerHTML=sPop;
popWidth=dypopLayer.clientWidth;
popHeight=dypopLayer.clientHeight;
if(MouseX+12+popWidth>document.body.clientWidth)
popLeftAdjust=-popWidth-24
else
popLeftAdjust=0;
if(MouseY+12+popHeight>document.body.clientHeight)
popTopAdjust=-popHeight-24
else
popTopAdjust=0;
dypopLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;
dypopLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;
dypopLayer.style.filter="Alpha(Opacity=0)";
fadeOut();
}
function fadeOut(){
if(dypopLayer.filters.Alpha.opacity<popOpacity){
dypopLayer.filters.Alpha.opacity+=showPopStep;
tFadeOut=setTimeout("fadeOut()",1);
}
else{
dypopLayer.filters.Alpha.opacity=popOpacity;
tFadeWaiting=setTimeout("fadeIn()",tPopShow);
}
}
function fadeIn(){
if(dypopLayer.filters.Alpha.opacity>0) {
dypopLayer.filters.Alpha.opacity-=1;
tFadeIn=setTimeout("fadeIn()",1);
}
}
document.onmouseover=showPopupText;
</script>
<a TITLE="快呀 <br> <br>发布时间: 2002/10/13 08:52pm <br>最后回复: 被骗了。。。。。。 ">快呀</a>
comnetorgcn 2003-07-01
  • 打赏
  • 举报
回复
用title不能分行,如果内容较多时,显示效果不太好,有没有其他办法?
gq 2003-07-01
  • 打赏
  • 举报
回复
看看上面的代码就应该有所认识了。。title的内容指的是移动到上面,显示的内容,表格中内容,就看自己咯。。想显示多少就取多少来显示。
comnetorgcn 2003-07-01
  • 打赏
  • 举报
回复
To: gq(游子)
能再说清楚点吗
gq 2003-07-01
  • 打赏
  • 举报
回复
<td width="50%" ><span title="<%=test%>"> <%=left(test,8)%></span></td>

87,988

社区成员

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

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