import socketdef handle_request(client): buf = client.recv(1024) client.send(bytes("HTTP/1.1 200 OK\r\n\r\n", encoding='utf-8')) client.send(bytes("<h1 style='background-color:red;'>Hello, Seven<h1>", encoding='utf-8'))def main(): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind(('localhost', 9999)) sock.listen(5) while True: conn, addr = sock.accept() handle_request(conn) conn.close()if __name__ == '__main__': main()import socketdef handle_request(client): buf = client.recv(1024) client.send(bytes("HTTP/1.1 200 OK\r\n\r\n", encoding='utf-8')) f = open('index', 'rb') data = f.read() f.close() client.send(data)def main(): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind(('localhost', 9999)) sock.listen(5) while True: conn, addr = sock.accept() handle_request(conn) conn.close()if __name__ == '__main__': main()<h1 style='background-color:red;'>Hello, Seven<h1><a href='http://www.baidu.com'>baidu</a><table border='1'> <tr> <td>1</td> <td>2</td> <td>3</td> </tr><table><!DOCTYPE html><html lang="en"><head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <!-- 页面编码 --> <meta http-equiv="Refresh" content="60"> <!-- 60s自动刷新一次页面 --> <!--<meta http-equiv="Refresh" content="5; url=http://www.baidu.com" /> 5s后跳转到目标网站--> <meta name="keywords" content="dongfei,dongfei2"> <meta http-equiv="X-UA-Compatible" content="IE=IE9;IE=IE8" /> <title>Title</title></head><body> <h1>welcome dongfei web site.</h1></body></html><link rel="shortcut icon" href="image/favicon.ico"> <!--给网站加图标-->5.1:各种符号
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>dongfei</title></head><body> <a href="http://www.baidu.com">百 >度</a> <h3>静夜思</h3> <h5>作者:李白</h5> <p>床前明月光,<br/>疑似地上霜。<br/>举头望明月,<br/>低头思故乡。</p> <span>dongfei</span></body></html>5.5:div标签,块级白板
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>login</title></head><body> <form action="http://localhost:xxx/index" method="get"> <!-- 向后端提交表单 --> <input type="text" name="username"/> <input type="text" name="email"/> <input type="password" name="password"/> <input type="button" value="login"/> <!--button默认没有任何功能--> <input type="submit" value="login2"/> </form></body></html><!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>sougou</title></head><body> <form action="https://www.sogou.com/web" method="get"> <input type="text" name="query" value="sogou"/> <!--value:默认值--> <input type="submit" value="搜索"> </form></body></html><!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title></head><body> <form> <div> <p>请选择性别:</p> 男:<input type="radio" name="gender" value="1" checked="checked" /> 女:<input type="radio" name="gender" value="2" /> <p>爱好:</p> 篮球:<input type="checkbox" name="favor" value="1" /> 足球:<input type="checkbox" name="favor" value="2" /> 乒乓球:<input type="checkbox" name="favor" value="3" /> </div> <input type="submit" value="提交" /> </form></body></html><!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title></head><body> <form enctype="multipart/form-data"> <div> <p>上传文件:</p> <input type="file" name="fname"> </div> <input type="submit" value="upload"> <input type="reset" value="reset"> </form></body></html><textarea name="menu" >默认值</textarea> <select name="city" multiple="multiple" size="3"> <option value="1">北京</option> <option value="2" selected="selected">上海</option> <option value="3">广州</option> </select> <input type="submit" value="提交"><a href="http://www.baidu.com" target="_blank">百度</a><!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title></head><body> <a href="#i1">第一章</a> <a href="#i2">第二章</a> <a href="#i3">第三章</a> <a href="#i4">第四章</a> <div id="i1" style="height:600px;">第一章的内容</div> <div id="i2" style="height:600px;">第二章的内容</div> <div id="i3" style="height:600px;">第三章的内容</div> <div id="i4" style="height:600px;">第四章的内容</div></body></html> <a href="http://www.baidu.com"> <img src="1.jpg" style="height: 200px;width: 200px;" alt="风景" title="风景"> </a> <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> </ul> <ol> <li>1</li> <li>2</li> <li>3</li> <li>4</li> </ol> <dl> <dt>123</dt> <dd>456</dd> </dl> <table border="1"> <tr> <td>第一行,第一列</td> <td>第一行,第二列</td> <td>第一行,第三列</td> </tr> <tr> <td>第二行,第一列</td> <td>第二行,第二列</td> <td>第二行,第三列</td> </tr> </table><table border="1"> <thead> <tr> <th>表头1</th> <th>表头2</th> <th>表头3</th> <th>表头4</th> </tr> </thead> <tbody> <tr> <td>内容1</td> <td>内容2</td> <td>内容3</td> <td>内容4</td> </tr> </tbody></table><td colspan="2">内容2</td><td rowspan="2">内容2</td> <label for="username">用户名:</label> <input id="username" type="text" name="user" /><!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title> <style> .c1{ background-color: #2459a2; height: 48px; } </style></head><body> <div class="c1">内容</div> <div class="c1">内容2</div></body></html>属性选择器:.c1[type=‘text‘]
<link rel="stylesheet" href="commons.css">color:字体颜色
块级标签漂起来堆叠
<div style="width: 20%;background-color: red;float: left">左侧</div> <div style="width: 60%;background-color: yellow;float: right">右侧</div> <div style="width: 50px; height: 50px; background-color: black; color: white; position: fixed;bottom: 20px;right: 20px;">返回顶部</div> <div style="height: 5000px;background-color: #dddddd;"></div><!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title> <style> .pg-header{ height: 48px; background-color: black; color: #dddddd; position: fixed; top: 0; right: 0; left: 0; } .pg-body{ background-color: #dddddd; height: 5000px; margin-top: 50px; } </style></head><body> <div class="pg-header">头部</div> <div class="pg-body">内容</div></body></html><!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title></head><body> <div style="position: relative;width: 500px;height: 200px;border: 1px solid red;margin: 0 auto;"> <div style="position: absolute;left: 0;bottom: 0;width: 50px;height: 50px;background-color: black;"></div> </div> <div style="position: relative;width: 500px;height: 200px;border: 1px solid red;margin: 0 auto;"> <div style="position: absolute;right: 0;bottom: 0;width: 50px;height: 50px;background-color: black;"></div> </div> <div style="position: relative;width: 500px;height: 200px;border: 1px solid red;margin: 0 auto;"> <div style="position: absolute;right: 0;top: 0;width: 50px;height: 50px;background-color: black;"></div> </div></body></html><!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title></head><body> <div style="position: fixed; background-color: white; height: 400px; width: 500px; top: 50%; left: 50%; margin-left: -250px; margin-top: -200px; z-index: 10; "></div> <div style="position: fixed;background-color: black; top: 0; bottom: 0; right: 0; left: 0; opacity: 0.5; z-index: 9; "></div> <div style="height: 5000px;background-color: green;">内容</div></body></html> <div style="height: 200px;width: 300px;overflow: hidden"> #混动条 <img src="win.jpg"> </div><!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>Title</title> <style> .pg-header{ position: fixed; right: 0; left: 0; top: 0; height: 44px; background-color: #2459a2; line-height: 44px; } .pg-body{ margin-top: 50px; } .w{ width: 980px; margin: 0 auto; } .menu{ display: inline-block; padding: 0 10px 0 10px; color: white; } /*当鼠标移动到当前标签上时,以下css属性才生效*/ .pg-header .menu:hover{ background-color: blue; } </style></head><body> <div class="pg-header"> <div class="w"> <a class="logo">LOGO</a> <a class="menu">全部</a> <a class="menu">段子</a> <a class="menu">1024</a> <a class="menu">小视频</a> </div> </div> <div class="pg-body"> <div class="w">正文</div> </div></body></html> <div style="background-image: url(icon_18_118.png);background-repeat: no-repeat;height: 20px;border: 1px solid red;width: 20px; background-position-x: 0; background-position-y: 2px; /*y轴移动图片*/ "></div><div style="background: url(icon_18_118.png) 0 -79px no-repeat;height: 20px;border: 1px solid red;width: 20px;"></div><!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>Title</title></head><body> <div style="width: 400px;height: 35px;position: relative;"> <input type="text" style="width: 370px;height: 35px;padding-right: 30px;"/> <span style="background: url(icon_18_118.png) 0 -139px no-repeat;width: 20px;height: 20px;display: inline-block;position: absolute;right: 0;top: 10px;"></span> </div></body></html><script src="commons-js.js"></script><script type="text/javascript"></script>age = 18; //声明变量,默认为字符串i = parseInt(age); //将age转换为整数k = parseFloat(age); //将age转换为浮点数obj.length 长度 obj.trim() 移除空白obj.trimLeft()obj.trimRight)obj.charAt(n) 返回字符串中的第n个字符obj.concat(value, ...) 拼接obj.indexOf(substring,start) 子序列位置obj.lastIndexOf(substring,start) 子序列位置obj.substring(from, to) 根据索引获取子序列obj.slice(start, end) 切片obj.toLowerCase() 大写obj.toUpperCase() 小写obj.split(delimiter, limit) 分割obj.search(regexp) 从头开始匹配,返回匹配成功的第一个位置(g无效)obj.match(regexp) 全局搜索,如果正则中有g表示找到全部,否则只找到第一个。obj.replace(regexp, replacement) 替换,正则中有g则替换所有,否则只替换第一个匹配项, $数字:匹配的第n个组内容; $&:当前匹配的内容; $`:位于匹配子串左侧的文本; $':位于匹配子串右侧的文本 $$:直接量$符号setInterval("alert('dongfei')", 5000); //定时器,每5s执行一次console.log(1); <div id="i1" style="text-align: center;font-size: 24px;">欢迎xxx莅临指导 </div> <script> function func() { var tag = document.getElementById('i1'); var content = tag.innerText; var f = content.charAt(0); var l = content.substring(1,content.length); var new_content = l + f; tag.innerText = new_content; } setInterval("func()", 500); </script>