简体   繁体   English

将 js 文件加载到我的 html 脚本标签中

[英]Loading a js file into my html script tag

My file structure is as follows:我的文件结构如下:

njtest 
  -> server.js
uripage
  -> landing.html

I'm trying to call a function from server.js in my landing.html using the following:我正在尝试使用以下命令从我的landing.html 中的server.js 调用function:

<script type="text/javascript" src="/ njtest/server.js"> 

Every time i receive the following error from Firefox browser:每次我从 Firefox 浏览器收到以下错误时:

Loading failed for the with source “file:///njtest/server.js”.源文件“file:///njtest/server.js”的加载失败。

You should try:你应该试试:

<script type="text/javascript" src="../njtest/server.js">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM