码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2017-11-05 18:29:46      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:back   containe   else   user   ace   输入关键字   rod   sha   登陆   

 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>
 6         首页
 7         {% block logintitle %}{% endblock %}
 8         {% block registertitle %}{% endblock %}
 9     </title>
10     <script>
11         function mySwitch() {
12             var oBody= document.getElementById("myBody");
13             var oOnoff=document.getElementById("myOnOff");
14             if(oOnoff.src.match("bulbon")){
15                 oOnoff.src="http://www.runoob.com/images/pic_bulboff.gif";
16                 oBody.style.background="black";
17                 oBody.style.color="yellow";
18             }else{oOnoff.src="http://www.runoob.com/images/pic_bulbon.gif";
19                 oBody.style.background="lightcyan";
20                 oBody.style.color="black";
21             }
22         }
23 
24     </script>
25    <link rel="stylesheet" type="text/css" href="../static/css/css.css">
26 {% block loginhead %}{% endblock %}
27 {% block registerhead %}{% endblock %}
28 
29 
30 </head>
31 
32 <body id="myBody" style="background-color:brown">
33 <nav>
34 
35 <img src="{{ url_for(‘static‘,filename=‘image/gzsxy.png‘) }}"alt="" width="20px">
36     <script>
37     document.write(Date())
38 </script>
39 <br>
40 
41     <a href="{{ url_for(‘switch‘) }}">首页</a>
42  <a href="{{ url_for(‘login‘) }}">登录</a>
43     <a href="{{ url_for(‘register‘) }}">注册</a>
44 
45    <input type="text" placeholder="请输入关键字">
46     <button type="submit">搜索</button>
47 
48 <p align="right"><img src="{{ url_for(‘static‘,filename=‘image/shan.jpg‘) }}"alt="" width="20px"></p>
49     <p align="right"> <img style="width: 20px" id="myOnOff" onclick="mySwitch()" src="
50     http://www.runoob.com/images/pic_bulbon.gif"></p>
51    </nav>
52 
53 
54 
55 
56 {% block loginbody %}{% endblock %}
57 {% block registerbody %}{% endblock %}
58 
59 </body>
60 </html>
技术分享
 1 {% extends ‘moban.html‘ %}
 2 
 3 {% block logintitle %}欢迎来到登录界面,请登录{% endblock %}
 4 {% block loginhead %}<script type="text/javascript" src="../static/js/login.js"></script>{% endblock %}
 5 {% block loginbody %}
 6     <p id="meto">中国标准时间</p>
 7 <script>document.getElementById("meto").innerHTML = Date()</script>
 8 <div id="container" style="width: 300px  ">
 9 
10     <div id="header" style="background-color: darkorange"><h2 align="center">登陆界面</h2></div>
11 
12     <div id="content">
13 
14             <p align="center">用户名:<input id="uname" type="text" name="user" placeholder="请输入账号">
15 
16             </p>
17             <p align="center"> 密码&nbsp<input id="upass" type="password" name="psw" placeholder="请输入密码"></p>
18 
19             <br>
20             <div id="error_box"><br>
21             </div>
22             <input type="radio" value="stu">学生
23             <input type="radio" value="tea">老师
24             <br>
25 
26             <input type="checkbox" value="true">记住密码 <a href="">登陆遇到问题</a><br>
27 
28          <p align="center"><button onclick="fnLogin()">登录</button></p>
29             &nbsp&nbsp&nbsp
30 
31 
32 
33     </div>
34 
35     <div id="footer" style="background-color: darkgoldenrod"><h3 align="center">版权所有@</h3></div>
36 </div>
37 {% endblock %}

 

 

 

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

标签:back   containe   else   user   ace   输入关键字   rod   sha   登陆   

原文地址:http://www.cnblogs.com/honghui/p/7788074.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!