Цитата:
Цитата:
|
Спасибо всем, разобрался.
|
<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> |
Jex, сурово) Сделайте красивее.
|
<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. |