我需要在django中包含我的JavaScript文件.我知道如何包含CSS文件.我是这样做的:
<link rel="stylesheet" href="{% static 'demo/style.css' %}"/>
Run Code Online (Sandbox Code Playgroud)
如何包含我的JavaScript文件?
小智 7
有两种方法可以执行此操作(内联脚本和外部脚本):
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Test page</title>
</head>
<body>
Inline script (option 1):
<script>
// your js code here
</script>
External script (option 2):
<script src="your-code-file.js"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
你可能对这个感兴趣:
<script src="your-code-file.js"></script>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
507 次 |
| 最近记录: |