Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   PHP, PERL, MySQL, JavaScript (https://forum.antichat.xyz/forumdisplay.php?f=37)
-   -   Скрипт загрузки страницы (https://forum.antichat.xyz/showthread.php?t=82517)

Zedi 27.08.2008 00:44

Скрипт загрузки страницы
 
Привет всем. Нужен скрипт чтоб было написано загрузка а в это время загружалась страница с картинками, чтобы потом показать все сразу

slesh 27.08.2008 09:55

как вариант можешешь попробовать или заюзать JS в области Microsoft.XMLHTTP или Msxml2.XMLHTTP
И постоить примерно такую систему. Грузится страница с картинкой типа загрузка.
попутно скритп грузит остальную часть страницы, а также заранее можно закешировать картинки, т.е. грузить в созданные через js - image. Затем скрываешь слой с картинкой и можно через document.write вывести остаток данных. а картинки браузер из кеша возьмет.

Ну или заюзай ajax

kap1k 27.08.2008 10:21

Код:

<html>
<head>
<title>Loading</title>
<script type="text/javascript"> 
function hideLoading() { 
document.getElementById('pageIsLoading').style. display = 'none'; 

</script> 
</head>

<body bgcolor="grey">
<div id="pageIsLoading" 
style=" 
position: absolute; 
display: block; 
padding-left: 44px; 
padding-right: 12px; 
width: auto; 
height: 46px; 
line-height: 46px; 
border: 1px solid #890000; 
color: #000000; 
font-weight: bold; 
background-color: #e5e5e5; 
background-image: url(http://адрес вашей картинки); 
background-position: 6px center; 
background-repeat: no-repeat;"> 
<script type="text/javascript"> 
if (typeof window_width == 'undefined' || typeof window_height == 'undefined') { 
var window_width; 
var window_height; 
if( typeof( window.innerWidth ) == 'number' ) { 
window_width = window.innerWidth; 
window_height = window.innerHeight; 
} else if( document.documentElement && 
( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { 
window_width = document.documentElement.clientWidth; 
window_height = document.documentElement.clientHeight; 
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { 
window_width = document.body.clientWidth; 
window_height = document.body.clientHeight; 


var left = Math.round((window_width - 200) / 2); 
var top = Math.round(((window_height - 46) / 3) + 46); 
document.getElementById('pageIsLoading').style.l eft = left+'px'; 
document.getElementById('pageIsLoading').style.t op = top+'px'; 
</script> 
Загружается... Ждите... 
</div>

<script type="text/javascript"> 
if (window.addEventListener) { 
window.addEventListener('load', hideLoading, false); 
} else if (window.attachEvent) { 
var r = window.attachEvent("onload", hideLoading); 
} else { 
hideLoading(); 

</script> 
</body>
</html>


Zedi 27.08.2008 21:02

Есть у кого еще готовые решения написать сам немогу т.к знаю пока только пхп, только под все браузеры плз

Jer1cho 27.08.2008 21:16

PHP код:

<html>
 <
head>
    <
title>test</title>
    <
style type="text/css">
        
body {
        
margin:0;
        }

        
#loading {
        
visibility:visible;
        
background:#eaeaea;
        
position:absolute;
        
width:100%;
        
height:100%;
        }
    </
style>
 </
head>
 <
body onload="document.getElementById('loading').style.visibility='hidden'">
    <
div id="loading">
        <
br/><br/><br/><br/>
        <
center><h2>Loading</h2></center>
    </
div>
    <
b>Something</b>
 </
body>
</
html



Время: 09:57