加载静态文件,父模板的继承和扩展

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了加载静态文件,父模板的继承和扩展相关的知识,希望对你有一定的参考价值。

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <title>{% block denglutitle %}{% endblock %}
         {% block zhucetitle %}{% endblock %}
     夜间模式</title>

<link rel="stylesheet" type="text/css" href="../static/css/test.css">
     <script>
        function mySwitch() {
            var oBody=document.getElementById("myBody");
            var oOnoff=document.getElementById("myOnOff");
            if (oOnoff.src.match("bulbon")){
                oOnoff.src="http://www.runoob.com/images/pic_bulboff.gif";
                oBody.style.background="black";
                oBody.style.color="white";

            }else {
                oOnoff.src="http://www.runoob.com/images/pic_bulbon.gif";
                oBody.style.background="white";
                oBody.style.color="black";

            }

        }
    </script>
{% block dengluhead %}{% endblock %}
{% block zhucehead %}{% endblock %}
</head>
<script>
    document.write(Date())
</script>
<nav>
 <a href="{{ url_for(‘test‘) }}">首页</a>
 <input type="text" ></input>
 <button type="submit">搜索</button>
 <a href="{{ url_for(‘denglu‘) }}">登录</a>
 <a href="{{ url_for(‘zhuce‘) }}">注册</a>
</nav>
<p align="right"><img id="myOnOff" onclick="mySwitch()" src="http://www.runoob.com/images/pic_bulbon.gif" width="40px"></p>



<body id="myBody">



{% block denglubody %}{% endblock %}
{% block zhucebody %}{% endblock %}
</body>



</html>
{% extends ‘test.html‘%}
{% block zhucetitle %}注册界面{% endblock %}
{% block zhucehead %}

    <meta charset="UTF-8">
    <title>注册界面</title>
    <script src="../static/js/wang.js"></script>
    <link rel="stylesheet" type="text/css" href="../static/css/zhuce.css">
{% endblock %}
{% block zhucebody %}

<div class="div" id="container">
    <div id="header" >
        <h2 class="h">注册</h2>
    </div>
    <div id="content">
            <p class="p">账号:
                <input id="uname" type="text" placeholder="请输入用户名">
            </p>
            <p class="p">密码:
                <input id="upass" type="password" >
            </p>
            <p class="p">再次输入密码:
                <input id="upass2" type="password" >
            </p>
            <div id="error_box"><br>
            </div>
    </div>
    <div>
        <button  onclick="fnLogin()">注册</button>
    </div>
    </div>
    <div>
        <i>版权信息@</i>
    </div>


{% endblock %}
{% extends ‘test.html‘%}
{% block denglutitle %}欢迎你,请先登陆!{% endblock %}



{% block dengluhead %}


    <script  src="../static/js/wang1.js"></script>
    <link rel="stylesheet"  type="text/css"  href="../static/css/zhuce.css">
{% endblock %}
{% block denglubody %}

<div class="div" id="container">
    <div id="header" >
        <h2 class="h">登陆</h2>
    </div>
    <div id="content">
            <p class="p">账号:
                <input id="uname" type="text" placeholder="请输入用户名">
            </p>
            <p class="p">密码:
                <input id="upass" type="password" >
            </p>
            <div id="error_box"><br>
            </div>
            <button  onclick="register()">登陆</button>
            &nbsp&nbsp&nbsp
            <input type="button" name="regist" value="注册">
    </div>
    <div>
        <i>版权信息@</i>
    </div>
</div>
{% endblock %}

 

以上是关于加载静态文件,父模板的继承和扩展的主要内容,如果未能解决你的问题,请参考以下文章

加载静态文件,父模板的继承和扩展

加载静态文件,父模板的继承和扩展

加载静态文件,父模板的继承和扩展

加载静态文件,父模板的继承和扩展

加载静态文件,父模板的继承和扩展

加载静态文件,父模板的继承和扩展