zoukankan      html  css  js  c++  java
  • 加入收藏和设置首页代码,设置在线人数代码

    <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>

     

  • 相关阅读:
    bzoj3786 星系探索
    [JSOI2008]火星人
    [NOI2005]维护数列
    [POI2008]砖块Klo
    郁闷的出纳员
    [HNOI2002]营业额统计
    [BZOJ1651][Usaco2006 Feb]Stall Reservations 专用牛棚
    [BZOJ2124]等差子序列
    [BZOJ3038]上帝造题的七分钟2
    [BZOJ1711][Usaco2007 Open]Dining吃饭
  • 原文地址:https://www.cnblogs.com/redfire/p/7702242.html
Copyright © 2011-2022 走看看