===100分求助一个问题!===

sunsfq 2003-11-27 08:55:01
我作一个足球相关网站,现有个比分项
如何实现:
鼠标指向比分时出现一个悬浮窗口用来显示进球信息,
鼠标移出时消失

急!!!
最好有原码!!
...全文
79 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
tigerwen01 2003-11-27
  • 打赏
  • 举报
回复
(接上)

// Sticky
function stc(d,text, title) {
sw = 1;
cnt = 0;
txt = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING="+border+" CELLSPACING=0 BGCOLOR=\""+backcolor+"\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><SPAN ID=\"PTT\"><FONT COLOR=\""+capcolor+"\">"+title+"</FONT></B></SPAN></TD><TD ALIGN=RIGHT><A HREF=/%22//%22 onMouseOver=\"cClick();\" ID=\"PCL\"><FONT COLOR=\""+closecolor+"\">Close</FONT></A></TD></TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\""+fcolor+"\"><TR><TD><SPAN ID=\"PST\"><FONT COLOR=\""+textcolor+"\">"+text+"</FONT><SPAN></TD></TR></TABLE></TD></TR></TABLE>"
layerWrite(txt);
dir = d;
disp();
snow = 0;
}

// Common calls
function disp() {
if ( (ns4) || (ie4) ) {
if (snow == 0) {
if (dir == 2) { // Center
moveTo(over,x+offsetx-(width/2),y+offsety);
}
if (dir == 1) { // Right
moveTo(over,x+offsetx,y+offsety);
}
if (dir == 0) { // Left
moveTo(over,x-offsetx-width,y+offsety);
}
showObject(over);
snow = 1;
}
}
// Here you can make the text goto the statusbar.
}

// Moves the layer
function mouseMove(e) {
if (ns4) {x=e.pageX; y=e.pageY;}
if (ie4) {x=event.x; y=event.y;}
if (ie5) {x=event.x+document.body.scrollLeft; y=event.y+document.body.scrollTop;}
if (snow) {
if (dir == 2) { // Center
moveTo(over,x+offsetx-(width/2),y+offsety);
}
if (dir == 1) { // Right
moveTo(over,x+offsetx,y+offsety);
}
if (dir == 0) { // Left
moveTo(over,x-offsetx-width,y+offsety);
}
}
}

// The Close onMouseOver function for Sticky
function cClick() {
hideObject(over);
sw=0;
}

// Writes to a layer
function layerWrite(txt) {
if (ns4) {
var lyr = document.overDiv.document
lyr.write(txt)
lyr.close()
}
else if (ie4) document.all["overDiv"].innerHTML = txt
if (tr) { trk(); }
}

// Make an object visible
function showObject(obj) {
if (ns4) obj.visibility = "show"
else if (ie4) obj.visibility = "visible"
}

// Hides an object
function hideObject(obj) {
if (ns4) obj.visibility = "hide"
else if (ie4) obj.visibility = "hidden"
}

// Move a layer
function moveTo(obj,xL,yL) {
obj.left = xL
obj.top = yL
}

function trk() {
if ( (ns4) || (ie4) ) {
nt=new Image(32,32); nt.src="http://www.nedstat.nl/cgi-bin/nedstat.gif?name=ol2t";
bt=new Image(1,1); bt.src="http://www.bosrup.com/web/overlib/o2/tr.gif";
refnd=new Image(1,1); refnd.src="http://www.nedstat.nl/cgi-bin/referstat.gif?name=ol2t&refer="+escape(top.document.referrer);

}
tr = 0;
}

2、以下代码是调用上面的JS文件(注意:两个文件要放在同一个目录下):
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>两大类</title>
</head>

<body>
<div id=overDiv style="Z-INDEX: 1; POSITION: absolute; left: 116px; top: 61px; width: 260">
<script language=JavaScript src="over.js"></script>
</div>
<table>
<tr>
<td>
<p align="center">
显示文本</p>
</td>
<tr>
<td height="5" colspan="2">  数据的逻辑结构是指数据间的逻辑关系,逻辑结构包括<a href="#" onMouseOver="dcc('线性表、栈、队列及串为线性结构,而树和图则为非线性结构。','·线性结构和非线性结构'); return true;" onMouseOut="nd(); return true;">两大类</a>:线性结构和非线性结构。物理结构又称存储结构,指数据元素在计算机存储器中的存储方式,存储方式一般有四种:顺序存储、链接存储、索引存储及散列存储,同一种逻辑结构采用不同存储方式可以得到不同的<a href="#" onMouseOver="dcc('如线性表以顺序存储方式存储时得到顺序表数据结构,而以链接存储方式存储则得到链表数据结构。','·数据结构'); return true;" onMouseOut="nd(); return true;">数据结构</a>。对于给定的逻辑结构需要寻找一种恰当的与其对应的存储结构,以便在计算机中存储。通常把这种对应关系称为映象。</td>
</tr>
</table>
</body>

tigerwen01 2003-11-27
  • 打赏
  • 举报
回复
楼上的title属性也可以,但停留时间短暂。使用以下代码很好:
1、把以下代码保存为over.js文件:
////////////////////////////////////////////////////////////////////////////////////
// overLIB 2.22 -- Please leave this notice.
//
// By Erik Bosrup (erik@bosrup.com) Last modified 1999-03-31
// Portions by Dan Steinman, Landon Bradshaw and Gnowknayme.
////////////////////////////////////////////////////////////////////////////////////

//请不要随便修改
////////////////////////////////////////////////////////////////////////////////////
// CONFIGURATION
////////////////////////////////////////////////////////////////////////////////////

// 主背景色(大区域)
// 通常使用明快的颜色(浅黄色等...)
if (typeof fcolor == 'undefined') { var fcolor = "#f0f0f0";}

// Border的颜色和标题栏的颜色;
// 通常的颜色深(褐色,黑色等。)
if (typeof backcolor == 'undefined') { var backcolor = "#666666";}


// 文字的颜色
// 通常是比较深的颜色;
if (typeof textcolor == 'undefined') { var textcolor = "#333333";}

// 标题的颜色
// 通常是明快的颜色;
if (typeof capcolor == 'undefined') { var capcolor = "#FFFFFF";}

// "Close"的颜色
// 通常是明快的颜色;
if (typeof closecolor == 'undefined') { var closecolor = "9999FF";}


// 弹出的窗口的宽度;
// 100-300 pixels 合适
if (typeof width == 'undefined') { var width = "260";}

// 边缘的宽度,象素。
// 1-3 pixels 合适
if (typeof border == 'undefined') { var border = "1";}


// 弹出窗口位于鼠标左侧或者右侧的距离,象素。
// 3-12合适
if (typeof offsetx == 'undefined') { var offsetx =25;}

// 弹出窗口位于鼠标下方的距离;
// 3-12 合适
if (typeof offsety == 'undefined') { var offsety =12;}

////////////////////////////////////////////////////////////////////////////////////
// 设置结束
////////////////////////////////////////////////////////////////////////////////////

ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false

// Microsoft Stupidity Check.
if (ie4) {
if (navigator.userAgent.indexOf('MSIE 5')>0) {
ie5 = true;
} else {
ie5 = false; }
} else {
ie5 = false;
}

var x = 0;
var y = 0;
var snow = 0;
var sw = 0;
var cnt = 0;
var dir = 1;
var tr = 1;
if ( (ns4) || (ie4) ) {
if (ns4) over = document.overDiv
if (ie4) over = overDiv.style
document.onmousemove = mouseMove
if (ns4) document.captureEvents(Event.MOUSEMOVE)
}

// 以下是页面中使用的公共函数;

// Simple popup right
function drs(text) {
dts(1,text);
}

// Caption popup right
function drc(text, title) {
dtc(1,text,title);
}

// Sticky caption right
function src(text,title) {
stc(1,text,title);
}

// Simple popup left
function dls(text) {
dts(0,text);
}

// Caption popup left
function dlc(text, title) {
dtc(0,text,title);
}

// Sticky caption left
function slc(text,title) {
stc(0,text,title);
}

// Simple popup center
function dcs(text) {
dts(2,text);
}

// Caption popup center
function dcc(text, title) {
dtc(2,text,title);
}

// Sticky caption center
function scc(text,title) {
stc(2,text,title);
}

// Clears popups if appropriate
function nd() {
if ( cnt >= 1 ) { sw = 0 };
if ( (ns4) || (ie4) ) {
if ( sw == 0 ) {
snow = 0;
hideObject(over);
} else {
cnt++;
}
}
}

// 非公共函数,被其它的函数调用;

// Simple popup
function dts(d,text) {
txt = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING="+border+" CELLSPACING=0 BGCOLOR=\""+backcolor+"\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\""+fcolor+"\"><TR><TD><FONT FACE=\"宋体\" COLOR=\""+textcolor+"\">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>"
layerWrite(txt);
dir = d;
disp();
}

// Caption popup
function dtc(d,text, title) {
txt = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING="+border+" CELLSPACING=0 BGCOLOR=\""+backcolor+"\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><SPAN ID=\"PTT\"><FONT COLOR=\""+capcolor+"\">"+title+"</FONT></B></SPAN></TD></TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\""+fcolor+"\"><TR><TD><SPAN ID=\"PST\"><FONT COLOR=\""+textcolor+"\">"+text+"</FONT><SPAN></TD></TR></TABLE></TD></TR></TABLE>"
layerWrite(txt);
dir = d;
disp();
}
(待续)
swich 2003-11-27
  • 打赏
  • 举报
回复
<a title=""></a>功能是实现了,效果可能不太好

建议你用层,用鼠标悬停属性控制它的显示

xieyj 2003-11-27
  • 打赏
  • 举报
回复
用 title 的提示属性
tzgpxl 2003-11-27
  • 打赏
  • 举报
回复
用楼上的方法可以实现,比较方便,不过效果不止到是不是能满足要求。

要将进球信息做得好看些,可以用CSS定义一个层,就象做下拉菜单一样做,下拉菜单的代码一大堆,相必完全能满足你的需求
tuoshi 2003-11-27
  • 打赏
  • 举报
回复
呵,这是最简单的方法,或者就是用层了。
  • 打赏
  • 举报
回复
<a title=""></a>

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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