See Website Root in JScript
To link to the root of the website in asp, I use ASP control (normal hyperlinks don't work!) And use the ebbing ~
However, I am trying to achieve the same thing with Jscript and it doesn't work.
I created a folder structure to better organize the files on my website. I put the Jscript file in the root directory of the folder structure and reference it like this:
"/superslight.js" this is on the main page
The user navigates to a page with one folder down the link, because it does not look at the site root, but the root of the current folder
Any ideas?
a source to share
use two dots to refer to the parent folder:
assuming you have the following folder structure
root ----> pages ----> myFile.aspx
root ----> ----> scripts myScript.js
you are referencing myScript.js in myFile.aspx like this:
<script type="text/javascript" src="../scripts/myScript.js" />