網(wǎng)頁顯示很奇怪...
這個是1.html的內(nèi)容:
<html>
<head>
<title>Hello</title>
<script>
function show_text(id, text){
document.getElementById(id).innerHTML = text;
}
function show_color(id, color){
document.getElementById(id).style.color = color;
}
</script>
<style>
#ll {width: 200px; font-size:40px;}
</style>
</head>
<body>
<label id="ll">test</label>
<div>
<a href="javascript:void(0);" onclick='javascript:show_text("ll", "My First JavaScript");'>My First JavaScript</a><br>
<a href="javascript:void(0);" onclick='javascript:show_text("ll", "Hello python")'>Hello python</a><br>
<a href="javascript:void(0);" onclick='javascript:show_color("ll", "#f00")'>red</a><br>
<a href="javascript:void(0);" onclick='javascript:show_color("ll", "#0f0")'>green</a><br>
</div>
</body>
</html>
import web
urls = (
'/(.*)', 'hello'
)
app = web.application(urls, globals())
class hello:
def GET(self, name):
return open(r'1.html', 'r').read()
if __name__ == "__main__":
app.run()
這個是hello.py的內(nèi)容:
import web
? ? ? ??
urls = (
? ? '/(.*)', 'hello'
)
app = web.application(urls, globals())
class hello: ? ? ? ?
? ? def GET(self, name):
? ? ? ? return open(r'1.html' , 'r').read()
if __name__ == "__main__":
? ? app.run()
然后輸入http://127.0.0.1:8080 訪問的時候,就是這樣的...
剛開始學(xué)習(xí),求大神指點(diǎn)
2018-09-06
改好了~