我正在尝试使用web.py创建网页。我创建了调用index.html的test.py。索引页面有2个选项卡。我希望在点击标签时只更改内容。
单击性能时:“这是性能”将打印在容器中。 当点击图书馆时:“这是图书馆”将在容器中打印。
test.py
import web
render = web.template.render('templates/')
urls = (
'/', 'index',
'/performance', 'performance',
'/(js|css|images)/(.*)', 'static',
)
class index:
def GET(self):
return render.index()
class performance:
def GET(self):
return render.index()
if __name__ == "__main__":
app = web.application(urls, globals())
app.run()
的index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Case</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="../static/testi.css">
</head>
<body>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">TESTING</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li><a href="/performance" id="Performance">Performance</a></li>
<li><a href="#" id="Library">Book Library</a></li>
</ul>
</div>
</div>
</nav>
<div class="container">
<h3>Collapsible Navbar</h3>
<p>In this example, the navigation bar is hidden on small screens and replaced by a button in the top right corner (try to re-size this window).
<p>Only when the button is clicked, the navigation bar will be displayed.</p>
</div>
<div id="footer" class="container">
<p>TEST</p>
<nav class="navbar navbar-default navbar-fixed-bottom"><p>TEST</p>
<div class="navbar-inner navbar-content-center">
<p class="text-muted credit">Testing project <a href="www.google.com">Martin Bean</a> </p>
</div>
</nav>
</div>
</body>
</html>