当前位置:主页>教程>网络编程>JSP技术>浮动菜单是如何作出来的mouse事件

浮动菜单是如何作出来的mouse事件
更新时间:2007-07-14 点击: 来源: 天极网



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();

}

// 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="/" 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;}



tags:

您可以: 点评它!(0条点评) 分享它!

ARTHD.COM网友点评共有0条点评,点击这里可查看):不能超过250字,请自觉遵守互联网相关政策法规。

广告位



合作伙伴

广告也精彩……

广告也精彩……