Hello all,
I am creating a web site with Visual Stuido 2008. I am trying to use
a java script file to create a busybox for login from this page
http://blogs.crsw.com/mark/articles/642.aspx.
I am using a master page senerio.
The erro I'm getting is
'busyBox' is not a member of 'ASP.login2_asp x'
This is the offeding code in the page:
<asp:Button ID="btnLogin" Runat="server" Text="Login" Width="59px"
OnClick="busyBo x.Show();" ></asp:Button>
Here is my page code>>>
<%@ Page Language="VB" Src="LdapAuthen tication.vb" MasterPageFile= "~/
TestMaster.mast er" AutoEventWireup ="false" CodeFile="Login 2.aspx.vb"
Inherits="Login 2" title="FastTrac k - Login" %>
<%@ MasterType VirtualPath="~/TestMaster.mast er" %>
<asp:Content ID="Content1" ContentPlaceHol derID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHol derID="ContentP laceHolder1"
Runat="Server">
<script language="javas cript" type="text/javascript"
src="CastleBusy Box.js">
// Instantiate BusyBox object
var busyBox = new BusyBox("BusyBo x1", "busyBox", 4, "images/
gears_ani_", ".gif", 125, 147, 207);
</script>
<table width="100%">
<tr>
<td align="middle">
 ,<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
 <asp:TextB ox ID="txtUsername "
Runat="server" BackColor="Blac k"
ForeColor="Whit e" BorderColor="#0 03399"
style="margin-left: 0px"
Width="177px" Font-Size="Medium"></
asp:TextBox>&nb sp, 
<asp:Label ID="Label2" Runat="server" ForeColor="#003 399" Font-
Size="Medium">U sername</asp:Label>
<asp:TextBox ID="txtPassword " Runat="server" TextMode="Passw ord"
BackColor="Blac k" Font-Size="Medium" ForeColor="Whit e"
BorderColor="#0 03399" Width="177px"></asp:TextBox>&nb sp
<asp:Label ID="Label3" Runat="server" ForeColor="#003 399" Font-
Size="Medium">P assword</asp:Label><br>
<asp:TextBox ID="txtDomain" Runat="server" BackColor="Blac k"
BorderColor="Wh ite" Font-Size="Small" ForeColor="Whit e"
Visible="False" >test.lcl</asp:TextBox>&nb sp, 
<asp:Label ID="Label1" Runat="server" ForeColor="#003 399" Font-
Size="Small" Visible="False" >Domain</asp:Label><br>
<asp:Button ID="btnLogin" Runat="server" Text="Login" Width="59px"
OnClick="busyBo x.Show();" ></asp:Button>
<br />
<asp:Label ID="errorLabel " Runat="server" ForeColor="#ff3 300"></
asp:Label>
<br>
 , <asp :CheckBox ID="chkPersist " Runat="server" Text="Persist
Cookie"
ForeColor="#003 399" Checked="True"
Visible="False" />
<iframe id="Iframe1" name="BusyBox1" frameBorder="0" scrolling="no"
ondrop="return false;"></iframe>
</td>
</tr>
</table>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHol derID="ContentP laceHolder2"
Runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHol derID="ContentP laceHolder3"
Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHol derID="ContentP laceHolder4"
Runat="Server">
</asp:Content>
Here is the code from the .js file
// ---------------------------
// Legal
// ---------------------------
// CastleBusyBox Control
// Castle Rock Software, LLC
// by Mark Wagner
// http://www.crsw.com
//
// Version: 1.2
//
// Copyright 2004, 2005 Castle Rock Software, LLC
// No warranty express or implied.
// ---------------------------
// General Notes
// ---------------------------
// The BusyBox javascript has been written so the BusyBox javascript
// control can be used with or without the Castle.BusyBox .NET
control.
// ---------------------------
// Constructor
// ---------------------------
// BusyBox class constructor
// Arguments:
// id - id of the IFrame tag to use.
// varName - name of the variable this instance of the busy box is
assigned to.
// imageCount - number of image in the animation sequence.
// imageNamePrefix - name prefix for each image.
// imageNameSuffix - name suffix for each image.
// imageDelay - number of milliseconds to display each image.
// width - defines the width of the busy box (required for Netscape
and Firefox)
// height - defines the height of the busy box (required for
Netscape and Firefox)
// url - (optional) url to the page containing the custom busy box
layout.
//
// This example uses the default busy box layout defined internally
(in the javascript).
// var busyBox = new BusyBox("BusyBo x1", "busyBox", 4, "gears_ani_ ",
".gif", 125, 147, 206)
//
// This example uses a custom busy box layout defined in the
BusyBox.htm file.
// var busyBox = new BusyBox("BusyBo x1", "busyBox", 4, "gears_ani_ ",
".gif", 125, 147, 206, "BusyBox.ht m")
//
function BusyBox(id, varName, imageCount, imageNamePrefix ,
imageNameSuffix , imageDelay, width, height, url)
{
// Initialize object
this.id = id;
this.ImageCount = imageCount;
this.CurrentIma geIndex = 0;
this.ImageWidth = 0;
this.ImageHeigh t = 0;
this.ImageNameP refix = imageNamePrefix ;
this.ImageNameS uffix = imageNameSuffix ;
this.ImageDelay = imageDelay;
this.DivID = "BusyBoxDiv ";
this.ImgID = "BusyBoxImg ";
this.Enabled = true;
this.Width = width;
this.Height = height;
// Retain the name of the instantiated object variable so that we can
animate
// using the setTimeout statement
this.VarName = varName;
// Allows us to stop the animation with clearTimeout(), should we
ever want to
this.timeout_id = null;
// Cache (pre-load) images
this.CacheImage s();
// Url to the page containing the busy box.
this.BusyBoxUrl = url;
// Get reference to the IFrame object
this.IFrame = document.getEle mentById(this.i d);
// Hide the busy box
this.Hide();
if( this.BusyBoxUrl )
// Load the busy box contents using a custom layout page.
this.LoadUrl(th is.BusyBoxUrl);
else
// Load the busy box contents using the internally defined layout.
this.RenderCont ent();
// If this browser does not support IFRAME tags then disable this
control. The
// next version will implement the use of a DIV instead of the IFRAME
tag;
// even though there are a couple minor issues with using DIV tags.
if( !frames[this.id] )
this.Enabled = false;
}
// --------------------------------
// Instance Methods
// --------------------------------
// GetIFrameDocume nt:
// Returns a reference to the document object in the IFrame.
BusyBox.prototy pe.GetIFrameDoc ument = function()
{
var doc;
if( this.IFrame.con tentDocument )
// For NS6
doc = this.IFrame.con tentDocument;
else if( this.IFrame.con tentWindow )
// For IE5.5 and IE6
doc = this.IFrame.con tentWindow.docu ment;
else if( this.IFrame.doc ument )
// For IE5
doc = this.IFrame.doc ument;
else
// TODO: Confirm this should be the default
doc = this.IFrame.doc ument;
return doc;
}
// LoadUrl:
// Changing the src attribute for an IFrame tag causes each new page
to be
// added to the browsers history object. This causes undesired
results for
// the user when they click the back button. Instead, we can use the
// document.locati on.replace() method to correctly load our busy box
// page into our IFrame.
//
// Arguments:
// url - url to the busy box page.
BusyBox.prototy pe.LoadUrl = function(url)
{
// Get a reference to the document object in the IFrame
var IFrameDoc = this.GetIFrameD ocument();
// Load the url using the replace method. This will prevent the
browsers
// history object from being updated with the new busybox url; thus
allowing
// the back button to function as desired for the user.
IFrameDoc.locat ion.replace(url );
}
// RenderContent:
// This method is used when the default busy box layout is used; not a
custom
// layout. This method is called when the url argument for the
constructor is null.
BusyBox.prototy pe.RenderConten t = function()
{
// Get the IFrame document object
var doc = this.GetIFrameD ocument();
var style = " style='BORDER: navy 3px solid; POSITION: absolute;' ";
doc.open();
doc.writeln("<b ody ondragstart='re turn false;' style='Margin: 0px;
Background-Color: white'>");
doc.writeln(" <div id='" + this.DivID + "' align=center " + style +
">");
doc.writeln(" <img id='" + this.ImgID + "' src=''>");
doc.writeln(" <br><h3>Process ing</h3>");
doc.writeln(" </div>");
doc.writeln("</body>");
doc.close();
}
// Resize:
// Resizes the busy box IFrame by setting its width and height
attributes
// to the size of its contents.
BusyBox.prototy pe.Resize = function()
{
// Resize the busy box IFrame.
if( BusyBox.IsBrows erIE() )
{
// Set the width by looking at its contents
var div = frames[this.id].document.getEl ementById(this. DivID);
this.IFrame.sty le.width = div.offsetWidth ;
this.IFrame.sty le.height = div.offsetHeigh t;
}
else
{
// Set the width to the value specified.
this.IFrame.sty le.width = this.Width;
this.IFrame.sty le.height = this.Height;
}
}
// Center:
// Centers the busy box IFrame on the page regardless of the browsers
// scroll position. This ensures the busy box is presented to the
user
// in a visible location in the window.
BusyBox.prototy pe.Center = function()
{
if( !this.IFrame )
return;
// Center the BusyBox in the window regardless of the scroll
positions
var objLeft = (document.body. clientWidth - this.IFrame.off setWidth) /
2;
var objTop = (document.body. clientHeight -
this.IFrame.off setHeight) / 2;
objLeft = objLeft + document.body.s crollLeft;
objTop = objTop + document.body.s crollTop;
// Position object
this.IFrame.sty le.position = "absolute";
this.IFrame.sty le.top = objTop;
this.IFrame.sty le.left = objLeft;
}
// CacheImages:
// Pre-loads the images from the server and stores a reference to each
// image. This allows the images to be presented to the user quickly
// for smooth image animation.
BusyBox.prototy pe.CacheImages = function()
{
// Instantiate the array to store the image references
this.Images = new Array(this.Imag eCount);
// Load all the images to cache into the aniframes array
for(var i = 0; i < this.ImageCount ; i++)
{
this.Images[i] = new Image();
this.Images[i].src = this.ImageNameP refix + i +
this.ImageNameS uffix;
}
}
// IsAnimating:
// Returns a boolean value representing the state of the animation.
BusyBox.prototy pe.IsAnimating = function()
{
if( this.timeout_id == null)
return false;
else
return true;
}
// IsVisible:
// Returns a boolean value representing the visibility state for the
busy box.
BusyBox.prototy pe.IsVisible = function()
{
var ifrm = document.getEle mentById(this.i d);
if( ifrm.style.visi bility == "visible" && ifrm.style.widt h 0 )
return true;
else
return false;
}
// Animate:
// Performs the animation process. This is accomplished by showing
the "current"
// image in the animation sequence process; and then submitting a
timed statement
// to execute in x number of milliseconds.
BusyBox.prototy pe.Animate = function()
{
// Assign the current image sequence to display
if( frames[this.id] )
// browser supports frames
frames[this.id].document.getEl ementById(this. ImgID).src =
this.Images[this.CurrentIma geIndex].src;
else
// browser does not support frames
document.getEle mentById(this.I mgID).src =
this.Images[this.CurrentIma geIndex].src;
// Auto re-center and re-size the busy box. This will force the busy
box to
// always appear in the center of the window even if the user
scrolls.
this.Resize();
this.Center();
// Increment the current image index
this.CurrentIma geIndex = (this.CurrentIm ageIndex +
1)%this.ImageCo unt;
// Display the next image in (imageDelay value) milliseconds (i.e.
125)
this.timeout_id = setTimeout(this .VarName + ".Animate() ;",
this.ImageDelay );
}
// StartAnimation:
// Starts the animation process.
BusyBox.prototy pe.StartAnimate = function()
{
if( this.IsAnimatin g() )
return;
this.Animate();
}
// StopAnimation:
// Stops the animation process.
BusyBox.prototy pe.StopAnimate = function()
{
clearTimeout(th is.timeout_id);
this.timeout_id = null;
}
// Hide:
// Hides the busy box making it invisible to the user.
BusyBox.prototy pe.Hide = function()
{
this.StopAnimat e();
// Hide the busy box.
this.IFrame.sty le.visibility = "hidden";
this.IFrame.sty le.width = 0;
this.IFrame.sty le.height = 0;
}
// Show:
// This function displays the busy box to the user. This function
centers the
// busy dialog box, makes it visible, and starts the animation. This
function
// will typically be called by the body event.
//
// Example:
// <body onbeforeunload= "busyBox.Show() ;" >
BusyBox.prototy pe.Show = function()
{
if( !this.Enabled )
return;
if( this.IsAnimatin g() || this.IsVisible( ) )
return;
this.Resize();
this.Center();
// Set the busy box to be visible and make sure it is on top of all
other controls.
this.IFrame.sty le.visibility = "visible";
this.IFrame.sty le.zIndex = "999999";
// Start the animation
this.StartAnima te();
}
// --------------------------------
// Class Methods
// --------------------------------
// IsBrowserIE:
// Returns true if the executing browser it a Microsoft Internet
Explorer browser.
BusyBox.IsBrows erIE = function()
{
try
{ return (window.navigat or.userAgent.in dexOf("MSIE ") 0); }
catch(x)
{ return false; }
}
// IsBrowserNS:
// Returns true if the executing browser it a Netscape browser.
BusyBox.IsBrows erNS = function()
{
try
{ return (window.navigat or.userAgent.in dexOf("Netscape ") 0); }
catch(x)
{ return false; }
}
// IsBrowserFirefo x:
// Returns true if the executing browser it a Firefox browser.
BusyBox.IsBrows erFirefox = function()
{
try
{ return (window.navigat or.userAgent.in dexOf("Firefox" ) 0); }
catch(x)
{ return false; }
}
Any help would be greatful.
Thanks,
Ty
I am creating a web site with Visual Stuido 2008. I am trying to use
a java script file to create a busybox for login from this page
http://blogs.crsw.com/mark/articles/642.aspx.
I am using a master page senerio.
The erro I'm getting is
'busyBox' is not a member of 'ASP.login2_asp x'
This is the offeding code in the page:
<asp:Button ID="btnLogin" Runat="server" Text="Login" Width="59px"
OnClick="busyBo x.Show();" ></asp:Button>
Here is my page code>>>
<%@ Page Language="VB" Src="LdapAuthen tication.vb" MasterPageFile= "~/
TestMaster.mast er" AutoEventWireup ="false" CodeFile="Login 2.aspx.vb"
Inherits="Login 2" title="FastTrac k - Login" %>
<%@ MasterType VirtualPath="~/TestMaster.mast er" %>
<asp:Content ID="Content1" ContentPlaceHol derID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHol derID="ContentP laceHolder1"
Runat="Server">
<script language="javas cript" type="text/javascript"
src="CastleBusy Box.js">
// Instantiate BusyBox object
var busyBox = new BusyBox("BusyBo x1", "busyBox", 4, "images/
gears_ani_", ".gif", 125, 147, 207);
</script>
<table width="100%">
<tr>
<td align="middle">
 ,<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
 <asp:TextB ox ID="txtUsername "
Runat="server" BackColor="Blac k"
ForeColor="Whit e" BorderColor="#0 03399"
style="margin-left: 0px"
Width="177px" Font-Size="Medium"></
asp:TextBox>&nb sp, 
<asp:Label ID="Label2" Runat="server" ForeColor="#003 399" Font-
Size="Medium">U sername</asp:Label>
<asp:TextBox ID="txtPassword " Runat="server" TextMode="Passw ord"
BackColor="Blac k" Font-Size="Medium" ForeColor="Whit e"
BorderColor="#0 03399" Width="177px"></asp:TextBox>&nb sp
<asp:Label ID="Label3" Runat="server" ForeColor="#003 399" Font-
Size="Medium">P assword</asp:Label><br>
<asp:TextBox ID="txtDomain" Runat="server" BackColor="Blac k"
BorderColor="Wh ite" Font-Size="Small" ForeColor="Whit e"
Visible="False" >test.lcl</asp:TextBox>&nb sp, 
<asp:Label ID="Label1" Runat="server" ForeColor="#003 399" Font-
Size="Small" Visible="False" >Domain</asp:Label><br>
<asp:Button ID="btnLogin" Runat="server" Text="Login" Width="59px"
OnClick="busyBo x.Show();" ></asp:Button>
<br />
<asp:Label ID="errorLabel " Runat="server" ForeColor="#ff3 300"></
asp:Label>
<br>
 , <asp :CheckBox ID="chkPersist " Runat="server" Text="Persist
Cookie"
ForeColor="#003 399" Checked="True"
Visible="False" />
<iframe id="Iframe1" name="BusyBox1" frameBorder="0" scrolling="no"
ondrop="return false;"></iframe>
</td>
</tr>
</table>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHol derID="ContentP laceHolder2"
Runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHol derID="ContentP laceHolder3"
Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHol derID="ContentP laceHolder4"
Runat="Server">
</asp:Content>
Here is the code from the .js file
// ---------------------------
// Legal
// ---------------------------
// CastleBusyBox Control
// Castle Rock Software, LLC
// by Mark Wagner
// http://www.crsw.com
//
// Version: 1.2
//
// Copyright 2004, 2005 Castle Rock Software, LLC
// No warranty express or implied.
// ---------------------------
// General Notes
// ---------------------------
// The BusyBox javascript has been written so the BusyBox javascript
// control can be used with or without the Castle.BusyBox .NET
control.
// ---------------------------
// Constructor
// ---------------------------
// BusyBox class constructor
// Arguments:
// id - id of the IFrame tag to use.
// varName - name of the variable this instance of the busy box is
assigned to.
// imageCount - number of image in the animation sequence.
// imageNamePrefix - name prefix for each image.
// imageNameSuffix - name suffix for each image.
// imageDelay - number of milliseconds to display each image.
// width - defines the width of the busy box (required for Netscape
and Firefox)
// height - defines the height of the busy box (required for
Netscape and Firefox)
// url - (optional) url to the page containing the custom busy box
layout.
//
// This example uses the default busy box layout defined internally
(in the javascript).
// var busyBox = new BusyBox("BusyBo x1", "busyBox", 4, "gears_ani_ ",
".gif", 125, 147, 206)
//
// This example uses a custom busy box layout defined in the
BusyBox.htm file.
// var busyBox = new BusyBox("BusyBo x1", "busyBox", 4, "gears_ani_ ",
".gif", 125, 147, 206, "BusyBox.ht m")
//
function BusyBox(id, varName, imageCount, imageNamePrefix ,
imageNameSuffix , imageDelay, width, height, url)
{
// Initialize object
this.id = id;
this.ImageCount = imageCount;
this.CurrentIma geIndex = 0;
this.ImageWidth = 0;
this.ImageHeigh t = 0;
this.ImageNameP refix = imageNamePrefix ;
this.ImageNameS uffix = imageNameSuffix ;
this.ImageDelay = imageDelay;
this.DivID = "BusyBoxDiv ";
this.ImgID = "BusyBoxImg ";
this.Enabled = true;
this.Width = width;
this.Height = height;
// Retain the name of the instantiated object variable so that we can
animate
// using the setTimeout statement
this.VarName = varName;
// Allows us to stop the animation with clearTimeout(), should we
ever want to
this.timeout_id = null;
// Cache (pre-load) images
this.CacheImage s();
// Url to the page containing the busy box.
this.BusyBoxUrl = url;
// Get reference to the IFrame object
this.IFrame = document.getEle mentById(this.i d);
// Hide the busy box
this.Hide();
if( this.BusyBoxUrl )
// Load the busy box contents using a custom layout page.
this.LoadUrl(th is.BusyBoxUrl);
else
// Load the busy box contents using the internally defined layout.
this.RenderCont ent();
// If this browser does not support IFRAME tags then disable this
control. The
// next version will implement the use of a DIV instead of the IFRAME
tag;
// even though there are a couple minor issues with using DIV tags.
if( !frames[this.id] )
this.Enabled = false;
}
// --------------------------------
// Instance Methods
// --------------------------------
// GetIFrameDocume nt:
// Returns a reference to the document object in the IFrame.
BusyBox.prototy pe.GetIFrameDoc ument = function()
{
var doc;
if( this.IFrame.con tentDocument )
// For NS6
doc = this.IFrame.con tentDocument;
else if( this.IFrame.con tentWindow )
// For IE5.5 and IE6
doc = this.IFrame.con tentWindow.docu ment;
else if( this.IFrame.doc ument )
// For IE5
doc = this.IFrame.doc ument;
else
// TODO: Confirm this should be the default
doc = this.IFrame.doc ument;
return doc;
}
// LoadUrl:
// Changing the src attribute for an IFrame tag causes each new page
to be
// added to the browsers history object. This causes undesired
results for
// the user when they click the back button. Instead, we can use the
// document.locati on.replace() method to correctly load our busy box
// page into our IFrame.
//
// Arguments:
// url - url to the busy box page.
BusyBox.prototy pe.LoadUrl = function(url)
{
// Get a reference to the document object in the IFrame
var IFrameDoc = this.GetIFrameD ocument();
// Load the url using the replace method. This will prevent the
browsers
// history object from being updated with the new busybox url; thus
allowing
// the back button to function as desired for the user.
IFrameDoc.locat ion.replace(url );
}
// RenderContent:
// This method is used when the default busy box layout is used; not a
custom
// layout. This method is called when the url argument for the
constructor is null.
BusyBox.prototy pe.RenderConten t = function()
{
// Get the IFrame document object
var doc = this.GetIFrameD ocument();
var style = " style='BORDER: navy 3px solid; POSITION: absolute;' ";
doc.open();
doc.writeln("<b ody ondragstart='re turn false;' style='Margin: 0px;
Background-Color: white'>");
doc.writeln(" <div id='" + this.DivID + "' align=center " + style +
">");
doc.writeln(" <img id='" + this.ImgID + "' src=''>");
doc.writeln(" <br><h3>Process ing</h3>");
doc.writeln(" </div>");
doc.writeln("</body>");
doc.close();
}
// Resize:
// Resizes the busy box IFrame by setting its width and height
attributes
// to the size of its contents.
BusyBox.prototy pe.Resize = function()
{
// Resize the busy box IFrame.
if( BusyBox.IsBrows erIE() )
{
// Set the width by looking at its contents
var div = frames[this.id].document.getEl ementById(this. DivID);
this.IFrame.sty le.width = div.offsetWidth ;
this.IFrame.sty le.height = div.offsetHeigh t;
}
else
{
// Set the width to the value specified.
this.IFrame.sty le.width = this.Width;
this.IFrame.sty le.height = this.Height;
}
}
// Center:
// Centers the busy box IFrame on the page regardless of the browsers
// scroll position. This ensures the busy box is presented to the
user
// in a visible location in the window.
BusyBox.prototy pe.Center = function()
{
if( !this.IFrame )
return;
// Center the BusyBox in the window regardless of the scroll
positions
var objLeft = (document.body. clientWidth - this.IFrame.off setWidth) /
2;
var objTop = (document.body. clientHeight -
this.IFrame.off setHeight) / 2;
objLeft = objLeft + document.body.s crollLeft;
objTop = objTop + document.body.s crollTop;
// Position object
this.IFrame.sty le.position = "absolute";
this.IFrame.sty le.top = objTop;
this.IFrame.sty le.left = objLeft;
}
// CacheImages:
// Pre-loads the images from the server and stores a reference to each
// image. This allows the images to be presented to the user quickly
// for smooth image animation.
BusyBox.prototy pe.CacheImages = function()
{
// Instantiate the array to store the image references
this.Images = new Array(this.Imag eCount);
// Load all the images to cache into the aniframes array
for(var i = 0; i < this.ImageCount ; i++)
{
this.Images[i] = new Image();
this.Images[i].src = this.ImageNameP refix + i +
this.ImageNameS uffix;
}
}
// IsAnimating:
// Returns a boolean value representing the state of the animation.
BusyBox.prototy pe.IsAnimating = function()
{
if( this.timeout_id == null)
return false;
else
return true;
}
// IsVisible:
// Returns a boolean value representing the visibility state for the
busy box.
BusyBox.prototy pe.IsVisible = function()
{
var ifrm = document.getEle mentById(this.i d);
if( ifrm.style.visi bility == "visible" && ifrm.style.widt h 0 )
return true;
else
return false;
}
// Animate:
// Performs the animation process. This is accomplished by showing
the "current"
// image in the animation sequence process; and then submitting a
timed statement
// to execute in x number of milliseconds.
BusyBox.prototy pe.Animate = function()
{
// Assign the current image sequence to display
if( frames[this.id] )
// browser supports frames
frames[this.id].document.getEl ementById(this. ImgID).src =
this.Images[this.CurrentIma geIndex].src;
else
// browser does not support frames
document.getEle mentById(this.I mgID).src =
this.Images[this.CurrentIma geIndex].src;
// Auto re-center and re-size the busy box. This will force the busy
box to
// always appear in the center of the window even if the user
scrolls.
this.Resize();
this.Center();
// Increment the current image index
this.CurrentIma geIndex = (this.CurrentIm ageIndex +
1)%this.ImageCo unt;
// Display the next image in (imageDelay value) milliseconds (i.e.
125)
this.timeout_id = setTimeout(this .VarName + ".Animate() ;",
this.ImageDelay );
}
// StartAnimation:
// Starts the animation process.
BusyBox.prototy pe.StartAnimate = function()
{
if( this.IsAnimatin g() )
return;
this.Animate();
}
// StopAnimation:
// Stops the animation process.
BusyBox.prototy pe.StopAnimate = function()
{
clearTimeout(th is.timeout_id);
this.timeout_id = null;
}
// Hide:
// Hides the busy box making it invisible to the user.
BusyBox.prototy pe.Hide = function()
{
this.StopAnimat e();
// Hide the busy box.
this.IFrame.sty le.visibility = "hidden";
this.IFrame.sty le.width = 0;
this.IFrame.sty le.height = 0;
}
// Show:
// This function displays the busy box to the user. This function
centers the
// busy dialog box, makes it visible, and starts the animation. This
function
// will typically be called by the body event.
//
// Example:
// <body onbeforeunload= "busyBox.Show() ;" >
BusyBox.prototy pe.Show = function()
{
if( !this.Enabled )
return;
if( this.IsAnimatin g() || this.IsVisible( ) )
return;
this.Resize();
this.Center();
// Set the busy box to be visible and make sure it is on top of all
other controls.
this.IFrame.sty le.visibility = "visible";
this.IFrame.sty le.zIndex = "999999";
// Start the animation
this.StartAnima te();
}
// --------------------------------
// Class Methods
// --------------------------------
// IsBrowserIE:
// Returns true if the executing browser it a Microsoft Internet
Explorer browser.
BusyBox.IsBrows erIE = function()
{
try
{ return (window.navigat or.userAgent.in dexOf("MSIE ") 0); }
catch(x)
{ return false; }
}
// IsBrowserNS:
// Returns true if the executing browser it a Netscape browser.
BusyBox.IsBrows erNS = function()
{
try
{ return (window.navigat or.userAgent.in dexOf("Netscape ") 0); }
catch(x)
{ return false; }
}
// IsBrowserFirefo x:
// Returns true if the executing browser it a Firefox browser.
BusyBox.IsBrows erFirefox = function()
{
try
{ return (window.navigat or.userAgent.in dexOf("Firefox" ) 0); }
catch(x)
{ return false; }
}
Any help would be greatful.
Thanks,
Ty
Comment