博客列表 >网站后台--2019-05-30

网站后台--2019-05-30

小人物的博客
小人物的博客原创
2019年06月02日 23:31:44643浏览

1. 使用iframe 实现网站后台架构与功能

实例

<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <title>网站后台</title>
    <style>
        .container {
            width:1000px;
            margin:0 auto;
            overflow:hidden;
        }

        .top {
            width:100%;
            height:60px;
            float:left;
            border-bottom: 1px solid #666;
            background-color: lightgrey;
        }

        .left {
            min-width: 160px;
            min-height: 500px;
            margin-left: 30px;
            float:left;
            /*background-color: lightgrey;*/
        }

        .left li{
            margin-top: 40px;
            list-style: none;
        }

        .right {
            min-width:750px;
            min-height:500px;
            margin-left:30px;
            float:left;
        }

        .right iframe {
            min-width: inherit;
            min-height: inherit;
            border-left: 1px solid black;
        }
    </style>
</head>
<body>
<div class="container">
    <!--顶部-->
    <div class="top">
        <p style="float:left;margin-left:30px">网站后台管理系统V1.0</p>
        <P style="float:right;margin-right:30px">admin  <a href=""> 退出</a></P>

    </div>
    <!--左侧-->
    <div class="left">
        <ul>
            <li><a href="user.html" target="content">用户管理</a></li>
            <li><a href="goods.html" target="content">商品管理</a></li>
            <li><a href="system.html" target="content">系统设置</a></li>
        </ul>
    </div>
    <!--右侧-->
    <div class="right">
        <iframe src="welcome.html" frameborder="0" name="content"></iframe>
        <p style="margin-top: -50px; text-align:center;">彼格教育科技***©版权所有<br>(2018-2020)</p>
    </div>

</div>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

2. 使用Ajax 实现网站后台架构与功能 

实例

<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <title>网站后台</title>
    <style>
        .container {
            width: 1000px;
            margin: 0 auto;
            overflow: hidden;
        }

        .top {
            height: 60px;
            width: 100%;
            float: left;
            border-bottom: 1px solid #666;
            background-color: lightgrey;
        }

        .left {
            float: left;
            min-height: 500px;
            min-width: 160px;
            margin-left: 30px;
            /*background-color: lightcoral;*/
        }

        .left li {
            margin-top: 40px;
            list-style: none;
        }

        .left a {
            text-decoration: none;
        }
        .right {
            float: left;
            min-height: 500px;
            min-width: 750px;
            margin-left: 30px;
            /*background-color: lightgreen;*/
        }

        .right .content {
            min-width: inherit;
            min-height: inherit;
            border-left: 1px solid #666;
        }


    </style>
</head>
<body onload="show(this)">
<div class="container">
    <!--顶部-->
    <div class="top">
        <p style="float:left;margin-left:30px">网站后台管理系统V1.0</p>
        <P style="float:right;margin-right:30px">admin  <a href=""> 退出</a></P>

    </div>
    <!--左侧-->
    <div class="left">
        <ul>
            <li><a href="user.html"  onclick="show(this);return false;" >用户管理</a></li>
            <li><a href="goods.html"  onclick="show(this); return false;">商品管理</a></li>
            <li><a href="system.html" onclick="show(this); return false;">系统设置</a></li>
        </ul>
    </div>
    <!--右侧-->
    <div class="right">
        <!--<iframe src="welcome.html" frameborder="0" name="content"></iframe>-->
        <div class="content"></div>
        <p style="margin-top: -50px; text-align:center;">彼格教育科技***1©版权所有<br>(2018-2020)</p>
    </div>
<script>
    function show(ele) {
        //获取跳转页面的地址
         var url = ele.href || 'welcome.html';
         var request =new XMLHttpRequest();
         request.onreadystatechange = function() {
             if (request.readyState === 4) {
                 var content = document.getElementsByClassName('content').item(0);
                 content.innerHTML = request.responseText;
             }
         };
         request.open('GET',url,true);
         request.send(null);
    }
</script>
</div>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

3. 使用bootstrap 美化网站后台管理系统

实例

<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <title>网站后台</title>
    <link rel="stylesheet" href="static/css/bootstrap.css">
    <link rel="stylesheet" href="static/css/style.css">
</head>

<body onload="show(this)">
<div class="container-fluid">
    <!--    第一行是顶部导航菜单-->
    <div class="row">
        <div class="col-md-12">
            <!--            设置导航背景-->
            <nav class="navbar navbar-default">
                <div class="container-fluid">
                    <!-- Brand and toggle get grouped for better mobile display -->
                    <div class="navbar-header">
                        <a class="navbar-brand" href="#">后台管理系统</a>
                    </div>

                    <!-- Collect the nav links, forms, and other content for toggling -->
                    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">


                        <ul class="nav navbar-nav navbar-right">
                            <li><a href="#">admin</a></li>
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">常用操作 <span class="caret"></span></a>
                                <ul class="dropdown-menu">
                                    <li><a href="#">个人中心</a></li>
                                    <li><a href="#">安全设置</a></li>
                                    <li role="separator" class="divider"></li>
                                    <li><a href="#" onclick="logout()">退出登录</a></li>
                                </ul>
                            </li>
                        </ul>
                    </div><!-- /.navbar-collapse -->
                </div><!-- /.container-fluid -->
            </nav>
        </div>
    </div>
</div>

<!--  第二部分, 分为左右二列,左侧为导航, 右侧为内容-->
<div class="container">
    <div class="row">
        <div class="col-md-3">
            <!--            左边导航用列表组来制作-->
            <div class="list-group" style="margin-top: 55px">
                <a href="user.html" class="list-group-item" onclick="show(this);return false">用户管理</a>
                <a href="goods.html" class="list-group-item" onclick="show(this);return false">商品管理</a>
                <a href="system.html" class="list-group-item" onclick="show(this);return false;">系统设置</a>
            </div>

        </div>

        <div class="col-md-9">
            <div class="content" style="min-height: 450px"></div>
            <p class="text-center">沙雕网络科技***©版权所有 <br> (2018-2020)</p>
        </div>
    </div>
</div>

<script>
    function show(ele) {
        //获取跳转页面的地址
         var url = ele.href || 'welcome.html';
         var request =new XMLHttpRequest();
         request.onreadystatechange = function() {
             if (request.readyState === 4) {
                 var content = document.getElementsByClassName('content').item(0);
                 content.innerHTML = request.responseText;
             }
         };
         request.open('GET',url,true);
         request.send(null);
    }

    // 退出登录
    function logout() {
        return confirm('是否真的退出') ? location.href='login.html' : false;
    }
</script>
<script src="static/js/jquery-3.4.1.js"></script>
<script src="static/js/bootstrap.js"></script>


</body>



</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例


声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议