<html>
<head>
<!--
{% block title %}
{% endblock %}
-->
<title>你好</title>
<link href="{{ url_for('static', path='css/styles.css') }}" rel="stylesheet">
<!-- 公共用的js
<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
<script src="{{ url_for('static', path='js/1.js') }}"></script>
-->
</head>
<body>
<!--
{% block content %}
{% endblock %}
{% block script %}
{% endblock %}
{% set url = "http://127.0.0.1:5000" %}
<a href={{url}}/html>ggghh</a>
{% set url = "/html" %}
<a href={{url}}>gggyyy</a>
-->
<h1>哈哈</h1>
{% set url = "http://127.0.0.1:8000" %} <a href={{url}}>ggg</a>
<a href={{url_for('static', path='html/h.html')}}>ddddd</a>
<img src="{{ url_for('static', path='images/1.png') }}" alt="" width="30" height="24">
<!--特定页面的js
<script src="{{ url_for('static', path='js/2.js') }}">
</script>
-->
<!--
<iframe width="80" height="80" src="http://www.baidu.com"></iframe>
-->
<tr>
{% for x in hd %}
<p>{{x}}</p>
{% endfor %}
<p>{{s}}</p>
{% set urls = "http://www.baidu.com" %} <a href={{urls}}>guuug</a>
<!--
<div id="messages"></div>
<script async>
var ws=new WebSocket("ws://127.0.0.1:8888/");
ws.onmessage=function q(event){
document.getElementById("messages").innerHTML=event.data+"</br>"
var messages=event.data;
console.log(event.data)
}
ws.onopen=function p(event){
ws.send('你好,服务器')
ws.send(event.data)
}
</script>
-->
<form action="" onsubmit="sendMessage(event)">
<input type="text" id="messageText" autocomplete="off"/>
<button>Send</button>
</form>
<ul id='messages'></ul>
<script>
var ws = new WebSocket("ws://localhost:5000/ws");
ws.onmessage = function(event) {
var messages = document.getElementById('messages')//.innerHTML=event.data+"</br>"
// var messages=event.data; //console.log(event.data)
var message = document.createElement('li')
var content = document.createTextNode(event.data)
message.appendChild(content)
messages.appendChild(message)
console.log(event.data)
};
function sendMessage(event) {
var input = document.getElementById("messageText")
ws.send(input.value)
input.value = ''
event.preventDefault()
}
</script>
<!--本页面扩展html/h.html(父文件)的所有(标签,js,css等所有),可以继承和覆盖父文件属性-->
{% extends "html/h.html" %}
<!--本页面包含>
{% include "h.html" %}
{% include "html/h.html" %}
{% include "h.html" %}
</body>
</html>