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>

     

  • 相关阅读:
    [再寄小读者之数学篇](2014-06-19 满足三个积分等式的函数)
    [再寄小读者之数学篇](2014-06-19 微分等式的结论)
    我的一些武功
    TEX学习笔记
    我的一些诗词
    我的课程与学生
    [再寄小读者之数学篇](2014-06-19 三维插值公式)
    [再寄小读者之数学篇](2014-06-19 旋度公式)
    JAVA小项目实例源码—学习娱乐小助手
    可拖拽的3D盒子
  • 原文地址:https://www.cnblogs.com/redfire/p/7702242.html
Copyright © 2011-2022 走看看