大家。我想在 html(webpy 模板)中包含 javascript,但它不起作用。html 中的 javascript 代码运行良好......
以下是主要的python文件(main.py):
urls = ('/main','main')
render = web.template.render('templates/')
class main:
def GET(self):
return render.main()
app = web.application(urls,globals())
if __name__ == "__main__":
app.run()
模板/main.htm:
<body>
<script type="text/javascript" src="include.js"></script>
<script>
alert(location.href); //this line works..
</script>
</body>
包括.js:
alert('test'); //this line doesn't work