📄 webresource.js
字号:
[,top:vTop]
[,left:vLeft]
[,anchor:vAnchor]
[,icon:vIcon]
});
(end)
Possible Values:
vTitle - *string* Optional title text for the balloon.
vMessage - *string* Optional. Message body for the balloon.
vFooter - *string* Optional. Test displayed at the bottom of the balloon on a separate line.
vTop - *integer* Optional. Offset from the top of the screen or top of an anchor.
vLeft - *integer* Optional. Offset from the left of the screen or left of an anchor.
vAnchor - *object* Optional. Reference to the object that the balloon should use as reference for location.
vIcon - *string* Optional. Possible icon values may include one of the values below (case sensitive):
- Exclaim - pre-defined, triangle with an exclamation point.
- Stop - pre-defined, red circle with a white x inside.
- Info - pre-defined, white balloon with a letter "i" inside *Default*
- Help - a question mark inside a blue circle.
- a relative path to a custom icon.
Examples:
- balloonObj.Show({title:'JavaScript Balloon Example',message:'This is an example of a JSBalloon object. It\'s primary application is to provide a modeless feedback to DHTML applications.',anchor:tableCellObj, icon:'Info'});
- balloonObj1.Show({title:'JavaScript Balloon Example',message:'This is an example of a JSBalloon object. It\'s primary application is to provide a modeless feedback to DHTML applications.',anchor:tableCellObj});
- balloonObj2.Show({message:'This is an example of a JSBalloon object. It\'s primary application is to provide a modeless feedback to DHTML applications. ',anchor:tableCellObj});
*/
this.icon = "Info";
this.anchor = anchor;
this.top = 0;
this.left = 0;
this.NorthEast;
this.NorthWest;
this.SouthEast;
this.SouthWest;
this.LeftBottom;
this.LeftTop;
this.Close;;
this.CloseActive;
this.CloseDown;
this.RightBottom;
this.RightTop;
var NorthEast;
var NorthWest;
var SouthEast;
var SouthWest;
var LeftBottom;
var LeftTop;
var Close;;
var CloseActive;
var CloseDown;
var RightBottom;
var RightTop;
function Show()
{
NorthEast=this.NorthEast;
NorthWest=this.NorthWest;
SouthEast=this.SouthEast;
SouthWest=this.SouthWest;
LeftBottom=this.LeftBottom;
LeftTop=this.LeftTop;
Close=this.Close;
CloseActive=this.CloseActive;
CloseDown=this.CloseDown;
RightBottom=this.RightBottom;
RightTop=this.RightTop;
var title = this.title;
var message= this.message;
var icon= this.icon;
var footer='';
var btop=this.top, bleft=this.left;
var atop=0, aleft=0;
var anchor=eval(this.anchor);
atop=getTop(anchor);
aleft=getLeft(anchor);
var direction='SE';
// Updates
blbWidth=String(this.width);
titleFontStyle=this.titleFontStyle;
messageFontStyle=this.messageFontStyle;
footerFontStyle=this.footerFontStyle;
transShowFilter=this.transShowFilter;
transHideFilter=this.transHideFilter;
transShow=this.transShow;
transHide=this.transHide;
autoHide=this.autoHide;
autoHideInterval=this.autoHideInterval;
autoAway=this.autoAway;
// Goodspeed 2006-7-28
// if(document.readyState!='complete')
// {
// alert('Document needs to fully load before you may show JSBalloons.');
// return;
// }
/*
if(Show.arguments.length>0)
{
var oArg=Show.arguments[0];
if(oArg.title!=null)
{
title=oArg.title;
}
if(oArg.message!=null)
{
message=oArg.message;
}
if(oArg.icon!=null)
{
icon=oArg.icon;
switch(icon)
{
case 'Exclaim':
icon = JSBalloonPath+'images/exclaim.ico';
SoundFx = 'Exclaim';
break;
case 'Stop':
icon = JSBalloonPath+'images/stop.ico';
SoundFx = 'Stop';
break;
case 'Info':
icon = JSBalloonPath+'images/info.ico';
SoundFx = 'Info';
break;
case 'Help':
icon = JSBalloonPath+'images/help.ico';
SoundFx = 'Info';
break;
default:
SoundFx = 'Info';
}
}
if(oArg.footer!=null)
{
footer=oArg.footer;
}
if(oArg.top!=null)
{
btop=oArg.top;
}
if(oArg.left!=null)
{
bleft=oArg.left;
}
if(oArg.anchor!=null)
{
anchor=oArg.anchor;
atop=getTop(anchor);
aleft=getLeft(anchor);
}
}
*/
// Figure out the best direction for the pointer
// Assume SE
var ret=balloonInfrastructure(balloonBody( title,
icon,
message,
footer,
this.titleFontStyle,
this.messageFontStyle,
this.footerFontStyle,
this.showCloseBox), direction);
// Populate the contents
balloonDIV.innerHTML=ret;
balloonDIV.style.width=String(blbWidth);
balloonDIV.style.filter=transShowFilter+' '+transHideFilter;
var btnClose=balloonDIV.children[0].children[0].children[1].children[0].children[0].children[0].children[0].children[2].children[0];
btnClose.onclick=this.Hide;
// check if the object is already initialized
if(typeof(childID)!='object')
{
childID=document.body.appendChild(balloonDIV);
}
if(anchor!=null)
{
balloonDIV.style.left = aleft+bleft;
balloonDIV.style.top = (atop-balloonDIV.offsetHeight)+btop;
}
else
{
balloonDIV.style.left = bleft;
balloonDIV.style.top = btop;
}
var bAdjustedLeft=parseInt(balloonDIV.style.left, 10);
var showSE;
if(document.body.offsetWidth < (bAdjustedLeft+balloonDIV.offsetWidth+20))
{
direction='SW';
ret=balloonInfrastructure(balloonBody( title,
icon,
message,
footer,
this.titleFontStyle,
this.messageFontStyle,
this.footerFontStyle,
this.showCloseBox), direction);
balloonDIV.innerHTML=ret;
balloonDIV.style.left = bAdjustedLeft-balloonDIV.offsetWidth+20;
showSE=false;
}
else
{
direction='SE';
showSE=true;
}
if(parseInt(balloonDIV.style.top, 10)<0)
{
if(showSE)
{
direction='NE';
ret=balloonInfrastructure(balloonBody( title,
icon,
message,
footer,
this.titleFontStyle,
this.messageFontStyle,
this.footerFontStyle,
this.showCloseBox), direction);
balloonDIV.innerHTML=ret;
}
else
{
direction='NW';
ret=balloonInfrastructure(balloonBody( title,
icon,
message,
footer,
this.titleFontStyle,
this.messageFontStyle,
this.footerFontStyle,
this.showCloseBox), direction);
balloonDIV.innerHTML=ret;
}
balloonDIV.style.top = parseInt(balloonDIV.style.top, 10)+balloonDIV.offsetHeight;
if(anchor!=null)
{
balloonDIV.style.top = parseInt(balloonDIV.style.top, 10)+anchor.offsetHeight
}
}
if(this.showCloseBox)
{
if(direction=='SE' || direction=='SW')
{
btnClose=balloonDIV.children[0].children[0].children[1].children[0].children[0].children[0].children[0].children[2].children[0];
}
else
{
btnClose=balloonDIV.children[0].children[0].children[2].children[0].children[0].children[0].children[0].children[2].children[0];
}
btnClose.onclick=this.Hide;
}
// Adjust all srollers
var scrollOffsets=ScrollOffsets(anchor);
balloonDIV.style.top=parseInt(balloonDIV.style.top, 10)-scrollOffsets[0];
balloonDIV.style.left=parseInt(balloonDIV.style.left, 10)-scrollOffsets[1];
// Hide any overlapping selects
SuppressSelects();
// Show balloon
if(this.transShow)
{
balloonDIV.style.filter=this.transShowFilter+' '+this.transHideFilter;
if(balloonDIV.filters(0).status==2 || balloonDIV.filters(0).status==1)
{
balloonDIV.filters(0).Stop();
}
balloonDIV.filters(0).Apply();
balloonDIV.style.visibility='visible';
balloonDIV.filters(0).Play();
}
else
{
balloonDIV.style.visibility='visible';
}
// Init autohide if true
if(this.autoHide)
{
clearTimeout(this.tmrBalloonPopup);
transHide=this.transHide;
this.tmrBalloonPopup=setTimeout(this.Hide, this.autoHideInterval);
}
if(this.autoAway)
{
balloonDIV.onmouseover=Hide;
}
else
{
balloonDIV.onmouseover='';
}
}
/* Function: Hide
Hide a visible balloon.
Call this function to immediately initiate the hiding of the instantiated balloon
with the predefined transition in <transHideFilter> depending on the setting of <transHide>.
*/
function Hide()
{
if(balloonDIV.style.visibility=='hidden')
{
return;
}
if(transHide)
{
if(balloonDIV.filters(1).status==2 || balloonDIV.filters(1).status==1)
{
balloonDIV.filters(1).Stop();
}
balloonDIV.filters(1).Apply();
balloonDIV.style.visibility='hidden';
balloonDIV.filters(1).Play();
}
else
{
balloonDIV.style.visibility='hidden';
}
RestoreSelects();
}
// Private
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -