demo
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()
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello</title>
<script type="text/javascript">
function show_text(id, text)
{
document.getElementById(id).innerHTML = text;
}
function show_color(id, color)
{
document.getElementById(id).style.color=color;
}
</script>
<style type="text/css">
div p { color: #f00; }
.py { font-size: 40px; }
#l1 { width: 100px; font-size: 40px; }
</style>
</head>
<body>
<h1>Hello</h1>
<div>World</div>
<p class="py">python</p>
<label id="l1">test</label>
<div>
<a href="javascript:void(0);" onclick='javascript:show_text("l1", "My First JavaScript");'>My First JavaScript</a>
<a href="javascript:void(0);" onclick='javascript:show_text("l1", "Hello python");'>Hello python</a>
<a href="javascript:void(0);" onclick='javascript:show_color("l1", "#f00");'>red</a>
<a href="javascript:void(0);" onclick='javascript:show_color("l1", "#0f0");'>green</a>
</div>
</body>
</html>