<div class="pro" style="height: 70%;width: 10vw;left:0vw;position: absolute;top:3vw;display: inline;">
<a href="#" onClick="showContent('game.php?page=trader')">Обмен ресурсов</a>
<a href="#" onClick="showContent('game.php?page=chat')">тут другая и так по аналогии </a>
</div>
<!--//-->
<div id="content">
<!-- CONTENT -->
</div>
<!--//-->
<div id="loading" style="display: none">
Идет загрузка...
</div>
<script>
function showContent(link) {
var cont = document.getElementById('content');
var loading = document.getElementById('loading');
cont.innerHTML = loading.innerHTML;
var http = createRequestObject();
if( http )
{ http.open('get', link);
http.onreadystatechange = function ()
{ if(http.readyState == 4)
{ cont.innerHTML = http.responseText; } }
http.send(null); }
else
{ document.location = link; } }
// ajax объект
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>
<script>
showContent('game.php?page=depot') // страница по умолчанию
</script>
<a href="#" onClick="showContent('game.php?page=trader')">Обмен ресурсов</a>
<a href="#" onClick="showContent('game.php?page=chat')">тут другая и так по аналогии </a>
</div>
<!--//-->
<div id="content">
<!-- CONTENT -->
</div>
<!--//-->
<div id="loading" style="display: none">
Идет загрузка...
</div>
<script>
function showContent(link) {
var cont = document.getElementById('content');
var loading = document.getElementById('loading');
cont.innerHTML = loading.innerHTML;
var http = createRequestObject();
if( http )
{ http.open('get', link);
http.onreadystatechange = function ()
{ if(http.readyState == 4)
{ cont.innerHTML = http.responseText; } }
http.send(null); }
else
{ document.location = link; } }
// ajax объект
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>
<script>
showContent('game.php?page=depot') // страница по умолчанию
</script>
The post was edited 3 times, last by Shandow ().