Jump to content

Pathstring = "..\images\picture.jpg" or Pathstring = "images\picture.jpg" ?


Archdeacon

Recommended Posts

I have been following various discussions on image preloading and my web site has these 2 items, "images" (folder) & "scripts.js" in the same directory.Which of these 2 lines of javascript is correct when called from 'scripts.js':pathstring = "..\images\picture.jpg" or pathstring = "images\picture.jpg", as I have seen both used?

Link to comment
Share on other sites

they're both wrong for the same reason, somewhat related to the issue at hand. in both cases it should be a forward slash. on the actual case of the trailing ../ and whatnot, it depends on the situation. Those two lines mean two different things. The ../ will move you up one directory from your CWD (current working directory). So ../ will move you up one from whatever directory script.js is in.Since both the folder and the file referencing the folder are in the directory, the second line, with forward slashes, would be what you need.

images/picture.jpg

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...