...

View Full Version : stay on page until other is loades



angvisola
12-16-2011, 01:11 AM
Hallo
i need heeeeeeeelp:confused:
I want to stay on page until other is loaded, with animated gif.

Lets say i want javascript to do something like this:

Stay on this page while the other is loaded and while page is loading play gif in this div
(some div, for example loading:)

Hope its clear :)
Thank you very much for any advice

Logic Ali
12-16-2011, 04:10 AM
Presumably you mean pre-load the destination page before showing it.

This has been requested previously.

Don't use it on destination sites that don't allow iframing.

<!DOCTYPE HTML>
<html>
<head>
<title>Test Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type='text/css'>
a,a:link,a:visited{padding:0.2em;}
a:hover,a:active{padding:0.2em;text-decoration:none}
#loadSign {display:none; position:fixed; top:50%; left:30%; width:40%; padding:1em; text-decoration:blink; color:#fff; background-color:#0c0; text-align:center; border-radius:0.2em }
</style>
<script type='text/javascript'>

function docPreload( ifId, actionId )
{
var args = docPreload.arguments,
showElem,
ifr;

function init( /*2843294C6F676963416C69*/ )
{
var ifLoadHandler;

ifr = document.getElementById( ifId );

showElem = document.getElementById( actionId );

installHandler( ifr, 'onload', ifLoadHandler = ( function( iframe ){ return function(){ showElem.style.display = 'none'; top.location.href = iframe.src; } } )( ifr ) );

installHandler( ifr, 'onerror', ifLoadHandler );

for( var i = 2; args[ i ]; i++ )
installHandler( document.getElementById( args[ i ] ), 'onclick', f );
}

installHandler( window, 'onload', init );

function f( e )
{
var elem = e.srcElement || e.target;

while( elem && elem.nodeName != 'A' )
elem = elem.parentNode;

if( elem )
{
e.preventDefault ? e.preventDefault() : e.returnValue = false;
showElem.style.display = 'inline';
ifr.src = elem.href;
}
}

function installHandler( obj, evt, func )
{
window.attachEvent ? obj.attachEvent(evt,func) : obj.addEventListener( evt.replace( /^on/i, "" ), func, false);
}
}
</script>
</head>
<body>
<script type='text/javascript'>
docPreload( 'myIframe', 'loadSign', 'linkA', 'linkB' ); /* OK to add more link IDs */
</script>
<iframe src='initial.htm' id='myIframe' width='0' height='0' style='display:none'></iframe>
<a href='http://wikipedia.com' id='linkA'>WikiPedia</a><p>
<a href='http://ebay.com' id='linkB'>EBay</a><p>
<span id='loadSign' ><b> LOADING... </b></span>
</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum