加入收藏和设置首页代码,设置在线人数代码

<script type="text/javascript" language="javascript">
//加入收藏
function AddFavorite(sURL, sTitle) {
sURL = encodeURI(sURL);
try{
window.external.addFavorite(sURL, sTitle);
}catch(e) {
try{
window.sidebar.addPanel(sTitle, sURL, "");
}catch (e) {
alert("加入收藏失败,请使用Ctrl+D进行添加,或手动在浏览器里进行设置.");
}
}
}
//设为首页
function SetHome(url){
if (document.all) {
document.body.style.behavior='url(#default#homepage)';
document.body.setHomePage(url);
}else{
alert("您好,您的浏览器不支持自动设置页面为首页功能,请您手动在浏览器里设置该页面为首页!");
}
}
</script>
<div class="hd-top-inner">
<div class="hd-top-inner">
<?if (empty($_SESSION['user'])){ ?>
<p><a onclick="SetHome(window.location)" href="javascript:void(0)" id="index_homepage">设为首页</a><a onclick="AddFavorite(window.location,document.title)" href="javascript:void(0)" id="index_shoucang">加入收藏</a><a href="#" class="loginbox" >登录</a>|<a href="user-register">注册</a></p>
<? }else{
$model = new model('wallet');
$wallet = $model->load(array('uid'=>$_SESSION['user']['id']));
$money = 0;
if (!empty($wallet['money'])){
$money = $wallet['money'];
}?>
你好,<span><?php echo $_SESSION['user']['username'];?></span> | &nbsp;您的钱包: <span><?=$money?></span> B币( <a href="/wallet-rechargeable" style="cursor:hand"><span>充值</span></a>) | <a href="user-logout" class="zhuxiao">退出</a>
<? } ?>
</div>
</div>

 

 

设置在线人数代码:

<li>
<script type="text/javascript">
var zaixian = 156524;
document.write("今日登陆用户:<span style='font-size:20px;color:#fa9602;'>"+Math.round(zaixian+Math.random()*1000)+"</span>人");
</script>
</li>

 

posted @ 2017-10-20 23:08  苍山雪洱海月  阅读(436)  评论(0编辑  收藏  举报