Javascript 包括脚本不';我不能在web.py中工作
每个人。我想在html(webpy模板)中包含javascript,但它不起作用。html中的javascript代码工作得很好 以下是主要python文件(main.py): 模板/main.htm:Javascript 包括脚本不';我不能在web.py中工作,javascript,python,web.py,Javascript,Python,Web.py,每个人。我想在html(webpy模板)中包含javascript,但它不起作用。html中的javascript代码工作得很好 以下是主要python文件(main.py): 模板/main.htm: <body> <script type="text/javascript" src="include.js"></script> <script> alert(location.href); //this line works.. </
<body>
<script type="text/javascript" src="include.js"></script>
<script>
alert(location.href); //this line works..
</script>
</body>
您必须将
include.js
文件放在项目根目录下的“static/js”目录中,src
应该是“static/js/include.js”。您必须将include.js
文件放在项目根目录下的“static/js”目录中,src
应该是“static/js/include.js”
<body>
<script type="text/javascript" src="include.js"></script>
<script>
alert(location.href); //this line works..
</script>
</body>
alert('test'); //this line doesn't work