multiple autostarts

Page: 1

Author Post
Member
Registered: Nov 2008
Posts: 28
Sir:

Is is possible to "autostart" multiple float boxes when a page loads?

FWC
Administrator
Registered: Aug 2008
Posts: 3382
Only one floatbox can be opened by assigning the 'autoStart:true' option to a floatboxed link. But an infinite number can be launched with the fb.start() API function.

It could look like this:
<script>
fb.DOMReady( function() {
fb.start(&#039;this.jpg&#039;);
fb.start(&#039;that.html&#039;);
} );
</script>

Or, the startup could be tied to the afterFBLoaded callback:
<script>
fbPageOptions = {
afterFBLoaded: function () {
fb.start(&#039;this.jpg&#039;);
fb.start(&#039;that.html&#039;);
}
};
</script>

Or, perhaps you want to chain the starts rather than having them pop right up. You could use the afterBoxStart callback of one item to open the next:
<script>
fbPageOptions = {
afterFBLoaded: function () {
fb.start( &#039;this.jpg&#039;, {
afterBoxStart: function () {
fb.start( &#039;that.html&#039;, {
afterBoxStart: function () {
fb.start( &#039;theOther.swf&#039;);
}
});
}
});
}
};
</script>


Of course, the API Reference will tell you (mostly) all there is to know about the fb.start function.
Member
Registered: Nov 2008
Posts: 28
Sir:

Can I wrap that in a conditional statement so that the float boxes only display under certain circumstances, for example:

<script language="javascript">
TheStartMsg = document.getElementById("TheStartMsg").value
if ( TheStartMsg == "OKShow" )
{
fbPageOptions = {
afterFBLoaded: function () {
fb.start('FIRG_GetOrganization_13.asp');
fb.start('popup_requestinfo_13.asp');
}
}
};
</script>


--FWC
Member
Registered: Nov 2008
Posts: 28
Sir:

I also tried without the conditional statment:

<script language="javascript">
TheStartMsg = document.getElementById("TheStartMsg").value

fbPageOptions = {
afterFBLoaded: function () {
fb.start('popup_requestinfo_13.asp');
fb.start('FIRG_GetOrganization_13.asp');
}
};


I am not getting any errors but I am also not seeing the floatbox.

---FWC
Administrator
Registered: Aug 2008
Posts: 3382
They are both probably failing because you are checking TheStartMsg value before it exists in the document and the script is consequently crashing. In your first code snippet, you would want to move that conditional check into the afterFBLoaded function. But I would have to see the live page to determine with certainty why the failure is occurring.

Page: 1