Javascript-форум (https://javascript.ru/forum/)
-   Events/DOM/Window (https://javascript.ru/forum/events/)
-   -   preloader на JS (https://javascript.ru/forum/events/31893-preloader-na-js.html)

bes 27.09.2012 00:29

Цитата:

Сообщение от trikadin
bes, а я искренне хотел, чтобы ему никто не рассказал об этом.

:-?
Цитата:

Сообщение от trikadin
Но то, что это очень убого - факт.

:yes:

serg1911 01.10.2012 10:34

Спасибо всем, разобрался.

Jex 02.10.2012 19:54

<html>
<head>
<title></title>
<script type='text/javascript'>
function showContent(link, block_id, loading_id)
{
var cont = document.getElementById(block_id);
var loading = document.getElementById(loading_id);
cont.innerHTML = loading.innerHTML;

<!-- Здесь изменения до перехода, например: cont.style.opacity = '0,2'; -->

    var http = createRequestObject();
   if( http )
    {
    	http.open('get', link);
     	
      	http.onreadystatechange = function ()
		{
			if(http.readyState == 4)
			{
<!-- Здесь изменения после перехода, например: cont.style.opacity = '1'; -->
   				cont.innerHTML = http.responseText;
			}
		}
        http.send(null);
  	}
	else
	{
		document.location = link;
	}
}

function createRequestObject()
{
	try
	{
		return new XMLHttpRequest();
	}
	catch(e)
	{
        try
        {
        	return new ActiveXObject('Msxml2.XMLHTTP');
        }
        catch(e)
        {
            try
            {
            	return new ActiveXObject('Microsoft.XMLHTTP');
            }
            catch(e)
            {
            	return null;
            }
        }
	}
}
</script>
</head>

<body id="body">

<div id="loading"></div>
<div id="content">
<span  onclick='send_message("content.php", "content", "loading");'>Next Page</span>
</div>

</body>
</html>

trikadin 03.10.2012 02:18

Jex, сурово) Сделайте красивее.

Jex 03.10.2012 03:51

<html>
<head>
<title></title>
<script type='text/javascript'>
function showContent(link, block_id, loading_id){
var cont = document.getElementById(block_id);
var loading = document.getElementById(loading_id);
cont.innerHTML = loading.innerHTML;
<!-- Здесь изменения до перехода, например: cont.style.opacity = '0,2'; -->
var http = createRequestObject();
if( http ){
http.open('get', link);
http.onreadystatechange = function (){
if(http.readyState == 4){<!-- Здесь изменения после перехода, например: cont.style.opacity = '1'; -->
cont.innerHTML = http.responseText;}}
http.send(null);}else{document.location = link;}}
function createRequestObject(){try{
return new XMLHttpRequest();}
catch(e){try{
return new ActiveXObject('Msxml2.XMLHTTP');}
catch(e){try{
return new ActiveXObject('Microsoft.XMLHTTP');}
catch(e){return null;}}}}
</script>
</head>
<body id="body">
<div id="loading"></div><div id="content"><span  onclick='send_message("content.php", "content", "loading");'>Next Page</span></div>
</body>
</html>


Как мог, как сказать, так сказать)


Часовой пояс GMT +3, время: 03:54.