Доброй ночи.
Долго искал / пытался сделать страницу с обновляющимся списком пользователей - не получаелось.
Нашел похожую реализацию (та что уж похожую, то что мне нужно) на одном сайте, но у меня возникла проблема с вставкой к себе на сайт.
Вот ссылка на то что я "нарыл".
JS код
Спойлер (Отобразить)
<script type="text/javascript">
var clip = null;
ZeroClipboard.setMoviePath( 'includes/ZeroClipboard.swf' );
function init()
{
clip = new ZeroClipboard.Client();
clip.setHandCursor( true );
_ccsjQ('div.clipboard').mousedown(
function()
{
clip.setText( _ccsjQ(this).text() );
if (clip.div)
{
clip.receiveEvent('mouseout', null);
clip.reposition(this);
}
else clip.glue(this);
clip.receiveEvent('mouseover', null);
} );
}
var ggh = null;
var ggl = null;
function getgame()
{
if(ggh && ggh.readystate != 4)
{
ggh.abort();
}
if ( _ccsjQ('#games_content').attr('rel') != 'none' )
{
ggh = _ccsjQ.get(_ccsjQ('#games_content').attr('rel'),
function(data)
{
_ccsjQ('#games_content').html(data);
});
}
}
function getlist()
{
if(ggl && ggl.readystate != 4)
{
ggl.abort();
}
ggl = _ccsjQ.get('includes/users.php?list', function(data)
{
_ccsjQ('#games_list').html(data);
});
}
setInterval('getgame()',1000);
setInterval('getlist()',1000);
function game(id, url)
{
_ccsjQ('#'+id).attr('rel', url);
getgame();
}
</script>
html код
Спойлер (Отобразить)<div id="games_list"></div>
<div id="games_content" style="width: 75%;" class="right" rel="none"></div>
Users.php
PHP:
скопировать код в буфер обмена
(набросал на скорую руку) <?PHP { $nm = $_GET["u"]; ?> User: <b><?PHP echo $nm; ?></b> <?PHP } if ( isset($_GET["list"]) ) { ?> <a href="javascript:game('games_content', 'includes/users.php?u=1');" title="Vasia" rel="folder_name">Vasia</a> <a href="javascript:game('games_content', 'includes/users.php?u=2');" title="Petia" rel="folder_name">Petia</a> <?PHP } ?>
Хоть убейте не получается.
У кого есть время, посмотрите пожалуйста.
|