开发者

The relativity of "<script src="

So on a HTML p开发者_如何学JAVAage, when you link to a JavaScript file, is it the same as it actually being there (like include() in php) or does everything have to be relative to the folder that the js file is in?

eg if I have <script src="scriptage/my.js"> </script> in index.html, is a image file to the js file 'image.png' or '../image.png'


JavaScript has no concept of files. Although certain extensions may provide file read/write APIs, everything is relative to the document.


Just like the php include(), it relates to the path of the file where you have attached the script. like here index.html


Your images should be relative to the JavaScript file, not the calling document.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜