标签:== 制作网站 black alt base height ext run ntb
夜间模式的开启与关闭
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script> function mySwitch() { var myele = document.getElementById("on_off") if (myele.src.match("bulbon")) { myele.src = "http://www.runoob.com/images/pic_bulboff.gif" document.getElementById("myBody").style.background = "black" document.getElementById("myBody").style.color = "white" } else { myele.src = "http://www.runoob.com/images/pic_bulbon.gif" document.getElementById("myBody").style.background = "white" document.getElementById("myBody").style.color = "black" } } </script> </head> <body id="myBody"> <img id="on_off" onclick="mySwitch()" src="http://www.runoob.com/images/pic_bulbon.gif" width="50px"> <script> document.write(Date()) </script>
父模板的制作
py
from flask import Flask, render_template
app = Flask(__name__)
@app.route(‘/‘)
def fu():
return render_template(‘fu.html‘)
@app.route(‘/test/‘)
def test():
return ‘test‘
@app.route(‘/login/‘)
def login():
return render_template(‘login.html‘)
@app.route(‘/regist/‘)
def regist():
return render_template(‘regist.html‘)
if __name__ == ‘__main__‘:
app.run(debug=True)
html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>首页</title> <link href="../static/fu.css" rel="stylesheet" type="text/css"> <script> function mySwitch() { var myele = document.getElementById("on_off") if (myele.src.match("bulbon")) { myele.src = "http://www.runoob.com/images/pic_bulboff.gif" document.getElementById("myBody").style.background = "black" document.getElementById("myBody").style.color = "white" } else { myele.src = "http://www.runoob.com/images/pic_bulbon.gif" document.getElementById("myBody").style.background = "white" document.getElementById("myBody").style.color = "black" } } </script> </head> <body id="myBody"> <img id="on_off" onclick="mySwitch()" src="http://www.runoob.com/images/pic_bulbon.gif" width="50px"> <input type="text" name="search"> <button type="submit">搜索</button> <a href="http://127.0.0.1:5000/">首页</a> <a href="http://127.0.0.1:5000/login">登录</a> <a href="http://127.0.0.1:5000/regist">注册</a> <h1>首页</h1> <hr> <a id="a">常见问题 / </a><a class="textblue">联系我们 / </a><a>用户意见 / </a><a>@create by haili</a> </body> </html>
标签:== 制作网站 black alt base height ext run ntb
原文地址:http://www.cnblogs.com/0058kyle/p/7784743.html