鼠标指向提示javascript程序
1
//定义变量、设置默认值
2
var LabelFontFace="宋体,arial,Verdana";
3
var LabelFontColor="#000000";
4
var LabelFontSize="9pt";
5
var LabelFontStyle="Font.PLAIN";
6
var LabelBorderColor="#000000";
7
var LabelBackColor="#FFFFE1";
8
//设置各个属性
9
function SetLabelFontFace(obj)
10
{
11
obj=Trim(obj);
12
if(obj==null || obj==""[img]/images/wink.gif[/img]
13
{
14
obj="宋体,arial,Verdana";
15
}
16
LabelFontFace=obj;
17
}
18
function SetLabelFontColor(obj)
19
{
20
obj=Trim(obj);
21
if(obj==null || obj==""[img]/images/wink.gif[/img]
22
{
23
obj="#000000";
24
}
25
LabelFontColor=obj;
26
}
27
function SetLabelFontSize(obj)
28
{
29
obj=Trim(obj);
30
if(obj==null || obj==""[img]/images/wink.gif[/img]
31
{
32
obj="9pt";
33
}
34
LabelFontSize=obj;
35
}
36
function SetLabelFontStyle(obj)
37
{
38
obj=Trim(obj);
39
if(obj==null || obj==""[img]/images/wink.gif[/img]
40
{
41
obj="Font.PLAIN";
42
}
43
LabelFontStyle=obj;
44
}
45
46
function SetLabelBorderColor(obj)
47
{
48
obj=Trim(obj);
49
if(obj==null || obj==""[img]/images/wink.gif[/img]
50
{
51
obj="#000000";
52
}
53
LabelBorderColor=obj;
54
}
55
56
function SetLabelBackColor(obj)
57
{
58
obj=Trim(obj);
59
if(obj==null || obj==""[img]/images/wink.gif[/img]
60
{
61
obj="#FFFFE1";
62
}
63
LabelBackColor=obj;
64
}
65
66
//合成文字样式
67
function SetTextStyle(str)
68
{
69
var strRet="";
70
var strStyle="";
71
strStyle="font-family:"+LabelFontFace+";";
72
strStyle+="color:"+LabelFontColor+";";
73
strStyle+="font-size:"+LabelFontSize+";";
74
switch(LabelFontStyle.toLowerCase())
75
{
76
case "font.plain":
77
strStyle+="font-weight: normal;";
78
strStyle+="font-style: normal;";
79
break;
80
case "font.bold":
81
strStyle+="font-weight: bold;";
82
strStyle+="font-style: normal;";
83
break;
84
case "font.italic":
85
strStyle+="font-weight: normal;";
86
strStyle+="font-style: italic;";
87
break;
88
case "font.italicbold":
89
case "font.bolditalic":
90
strStyle+="font-weight: bold;";
91
strStyle+="font-style: italic;";
92
break;
93
default:
94
strStyle+="font-weight: bold;";
95
strStyle+="font-style: italic;";
96
break;
97
}
98
strRet="<font style='"+strStyle+"'>";
99
strRet+=" "+str+" ";
100
strRet+="</font>";
101
return strRet;
102
}
103
104
//合成表格样式
105
function SetTableStyle()
106
{
107
var strRet="";
108
strRet+="border-right: "+LabelBorderColor+" 1px solid;";
109
strRet+="border-top: "+LabelBorderColor+" 1px solid;";
110
strRet+="border-left: "+LabelBorderColor+" 1px solid;";
111
strRet+="border-bottom: "+LabelBorderColor+" 1px solid;";
112
strRet+="background-color:"+LabelBackColor;
113
return strRet;
114
}
115
116
//显示提示
117
function ShowNote(str)
118
{
119
var strHtml;
120
strHtml="";
121
strHtml+="<table height=1px width=1px border='0'cellspacing='0' cellpadding='0' style='" + SetTableStyle() + "'>";
122
strHtml+="<tr>";
123
strHtml+="<td>"+SetTextStyle(str)+"</td>";
124
strHtml+="</tr>";
125
strHtml+="</table>";
126
if (document.all&&document.readyState=="complete"[img]/images/wink.gif[/img]
127
{
128
document.all.div_Note.innerHTML=strHtml;
129
document.all.div_Note.style.pixelLeft=event.clientX+document.body.scrollLeft+10
130
document.all.div_Note.style.pixelTop=event.clientY+document.body.scrollTop+10
131
document.all.div_Note.style.visibility="visible"
132
}
133
}
134
135
//隐藏提示
136
function HideNote()
137
{
138
if (document.all)
139
{
140
document.all.div_Note.style.visibility="hidden";
141
}
142
else
143
{
144
if (document.layers)
145
{
146
clearInterval(currentscroll)
147
document.div_Note.visibility="hidden";
148
}
149
}
150
}
151
152
//初始化
153
function Init()
154
{
155
window.document.write("<div id=\"div_Note\" style=\"VISIBILITY:hidden; POSITION:absolute; HEIGHT:13px;z-index:1\"></div>"[img]/images/wink.gif[/img];
156
}
157
Init();
158
159
//生成提示字符
160
function ShowLabel(text,note,bclick)
161
{
162
if(bclick!=null)
163
{
164
return "<a href=\"#\" onMouseOver=\"ShowNote('" + note + "')\" onMouseOut=\"HideNote()\" onClick=\"JavaScript[img]/images/biggrin.gif[/img]oSomeThing(this);\">" + text + "</a>";
165
}
166
else
167
{
168
return "<a href=\"#\" onMouseOver=\"ShowNote('" + note + "')\" onMouseOut=\"HideNote()\">" + text + "</a>";
169
}
170
}
171![]()
//定义变量、设置默认值2
var LabelFontFace="宋体,arial,Verdana";3
var LabelFontColor="#000000";4
var LabelFontSize="9pt";5
var LabelFontStyle="Font.PLAIN";6
var LabelBorderColor="#000000";7
var LabelBackColor="#FFFFE1";8
//设置各个属性9
function SetLabelFontFace(obj)10
{11
obj=Trim(obj);12
if(obj==null || obj==""[img]/images/wink.gif[/img]13
{14
obj="宋体,arial,Verdana";15
}16
LabelFontFace=obj;17
}18
function SetLabelFontColor(obj)19
{20
obj=Trim(obj);21
if(obj==null || obj==""[img]/images/wink.gif[/img]22
{23
obj="#000000";24
}25
LabelFontColor=obj;26
}27
function SetLabelFontSize(obj)28
{29
obj=Trim(obj);30
if(obj==null || obj==""[img]/images/wink.gif[/img]31
{32
obj="9pt";33
}34
LabelFontSize=obj;35
}36
function SetLabelFontStyle(obj)37
{38
obj=Trim(obj);39
if(obj==null || obj==""[img]/images/wink.gif[/img]40
{41
obj="Font.PLAIN";42
}43
LabelFontStyle=obj;44
}45
46
function SetLabelBorderColor(obj)47
{48
obj=Trim(obj);49
if(obj==null || obj==""[img]/images/wink.gif[/img]50
{51
obj="#000000";52
}53
LabelBorderColor=obj;54
}55
56
function SetLabelBackColor(obj)57
{58
obj=Trim(obj);59
if(obj==null || obj==""[img]/images/wink.gif[/img]60
{61
obj="#FFFFE1";62
}63
LabelBackColor=obj;64
}65
66
//合成文字样式67
function SetTextStyle(str)68
{69
var strRet="";70
var strStyle="";71
strStyle="font-family:"+LabelFontFace+";";72
strStyle+="color:"+LabelFontColor+";";73
strStyle+="font-size:"+LabelFontSize+";";74
switch(LabelFontStyle.toLowerCase())75
{76
case "font.plain":77
strStyle+="font-weight: normal;";78
strStyle+="font-style: normal;";79
break;80
case "font.bold":81
strStyle+="font-weight: bold;";82
strStyle+="font-style: normal;";83
break;84
case "font.italic":85
strStyle+="font-weight: normal;";86
strStyle+="font-style: italic;";87
break;88
case "font.italicbold":89
case "font.bolditalic":90
strStyle+="font-weight: bold;";91
strStyle+="font-style: italic;";92
break;93
default:94
strStyle+="font-weight: bold;";95
strStyle+="font-style: italic;";96
break;97
}98
strRet="<font style='"+strStyle+"'>";99
strRet+=" "+str+" ";100
strRet+="</font>";101
return strRet;102
}103
104
//合成表格样式105
function SetTableStyle()106
{107
var strRet="";108
strRet+="border-right: "+LabelBorderColor+" 1px solid;";109
strRet+="border-top: "+LabelBorderColor+" 1px solid;";110
strRet+="border-left: "+LabelBorderColor+" 1px solid;";111
strRet+="border-bottom: "+LabelBorderColor+" 1px solid;";112
strRet+="background-color:"+LabelBackColor; 113
return strRet;114
}115
116
//显示提示117
function ShowNote(str)118
{119
var strHtml;120
strHtml="";121
strHtml+="<table height=1px width=1px border='0'cellspacing='0' cellpadding='0' style='" + SetTableStyle() + "'>";122
strHtml+="<tr>";123
strHtml+="<td>"+SetTextStyle(str)+"</td>";124
strHtml+="</tr>";125
strHtml+="</table>"; 126
if (document.all&&document.readyState=="complete"[img]/images/wink.gif[/img]127
{ 128
document.all.div_Note.innerHTML=strHtml;129
document.all.div_Note.style.pixelLeft=event.clientX+document.body.scrollLeft+10130
document.all.div_Note.style.pixelTop=event.clientY+document.body.scrollTop+10131
document.all.div_Note.style.visibility="visible"132
} 133
}134
135
//隐藏提示136
function HideNote()137
{138
if (document.all)139
{140
document.all.div_Note.style.visibility="hidden";141
}142
else143
{144
if (document.layers)145
{146
clearInterval(currentscroll)147
document.div_Note.visibility="hidden";148
}149
} 150
}151
152
//初始化153
function Init()154
{155
window.document.write("<div id=\"div_Note\" style=\"VISIBILITY:hidden; POSITION:absolute; HEIGHT:13px;z-index:1\"></div>"[img]/images/wink.gif[/img];156
}157
Init();158
159
//生成提示字符160
function ShowLabel(text,note,bclick)161
{162
if(bclick!=null)163
{164
return "<a href=\"#\" onMouseOver=\"ShowNote('" + note + "')\" onMouseOut=\"HideNote()\" onClick=\"JavaScript[img]/images/biggrin.gif[/img]oSomeThing(this);\">" + text + "</a>";165
}166
else167
{168
return "<a href=\"#\" onMouseOver=\"ShowNote('" + note + "')\" onMouseOut=\"HideNote()\">" + text + "</a>";169
}170
}171




浙公网安备 33010602011771号