473,473 Members | 2,232 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

using the ~/ path with script files?

hi there,

i'm currently using the following line:

<script language="javascript" type="text/javascript"
src="../scripts/timer.js"></script>

but i want to do the following, as the script needs to be used in many pages
at varios folder depths ( it is placed in my master page).

<script language="javascript" type="text/javascript"
src="~/scripts/timer.js"></script>

doesnt ASP.NET 2.0 pick up that i've put the "~/" symbol in the script SRC
parameter, as it only works on the pages within the SRC root "../" which im
currently using.

any help appreciated.

thanks,
Paul.
Jan 31 '07 #1
8 1649
Hi,

Milsnips wrote:
hi there,

i'm currently using the following line:

<script language="javascript" type="text/javascript"
src="../scripts/timer.js"></script>
The "language" attribute has been deprecated, and you should remove it.
>
but i want to do the following, as the script needs to be used in many pages
at varios folder depths ( it is placed in my master page).

<script language="javascript" type="text/javascript"
src="~/scripts/timer.js"></script>
<script type="text/javascript"
src="/scripts/timer.js"></script>

This looks for the "scripts" folder at the root of the website.

HTH,
Laurent
>
doesnt ASP.NET 2.0 pick up that i've put the "~/" symbol in the script SRC
parameter, as it only works on the pages within the SRC root "../" which im
currently using.

any help appreciated.

thanks,
Paul.
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Jan 31 '07 #2
hi Laurent,

it isnt solving my problem, this is the folder heirarchy i have, and where
my javascript works and doesnt
ROOT
SCRIPTS/
timer.js
TEMPLATES/
main.master - with following line: <script
type="text/javascript" src="../scripts/timer.js"></script>
EN/
projects.aspx - javascript works on this file.
PROJECTS/
active.aspx - javascript DOESNT work here..
completed.aspx - javascript also DOESNT work here..
I hope you understand the folder heirarchy i;ve done, the BOLD items are
folders

regards,
Paul

"Laurent Bugnion [MVP]" <ga*********@bluewin.chwrote in message
news:Oh**************@TK2MSFTNGP02.phx.gbl...
Hi,

Milsnips wrote:
>hi there,

i'm currently using the following line:

<script language="javascript" type="text/javascript"
src="../scripts/timer.js"></script>

The "language" attribute has been deprecated, and you should remove it.
>>
but i want to do the following, as the script needs to be used in many
pages at varios folder depths ( it is placed in my master page).

<script language="javascript" type="text/javascript"
src="~/scripts/timer.js"></script>

<script type="text/javascript"
src="/scripts/timer.js"></script>

This looks for the "scripts" folder at the root of the website.

HTH,
Laurent
>>
doesnt ASP.NET 2.0 pick up that i've put the "~/" symbol in the script
SRC parameter, as it only works on the pages within the SRC root "../"
which im currently using.

any help appreciated.

thanks,
Paul.
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch

Jan 31 '07 #3
Hi,

Milsnips wrote:
hi Laurent,

it isnt solving my problem, this is the folder heirarchy i have, and where
my javascript works and doesnt
ROOT
SCRIPTS/
timer.js
TEMPLATES/
main.master - with following line: <script
type="text/javascript" src="../scripts/timer.js"></script>
I think I suggested src="/scripts/timer.js"

The masterpage is a control. The path to the "scripts" folder is
relative to the page (ASPX), *not* to the master.

My suggestion is an absolute path pointing to the "scripts" folder in
the website root. I still think it should work.

HTH,
Laurent
EN/
projects.aspx - javascript works on this file.
PROJECTS/
active.aspx - javascript DOESNT work here..
completed.aspx - javascript also DOESNT work here..
I hope you understand the folder heirarchy i;ve done, the BOLD items are
folders

regards,
Paul
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Jan 31 '07 #4
Hi there,

Try this one:

<script language="javascript" src="<%=ResolveClientUrl("~/scripts/timer.js")
%"></script>

or in master page load event

Page.ClientScript.RegisterClientScriptInclude("tim erScript",
ResolveClientUrl("~/scripts/timer.js"));
--
Milosz
"Milsnips" wrote:
hi Laurent,

it isnt solving my problem, this is the folder heirarchy i have, and where
my javascript works and doesnt
ROOT
SCRIPTS/
timer.js
TEMPLATES/
main.master - with following line: <script
type="text/javascript" src="../scripts/timer.js"></script>
EN/
projects.aspx - javascript works on this file.
PROJECTS/
active.aspx - javascript DOESNT work here..
completed.aspx - javascript also DOESNT work here..
I hope you understand the folder heirarchy i;ve done, the BOLD items are
folders

regards,
Paul

"Laurent Bugnion [MVP]" <ga*********@bluewin.chwrote in message
news:Oh**************@TK2MSFTNGP02.phx.gbl...
Hi,

Milsnips wrote:
hi there,

i'm currently using the following line:

<script language="javascript" type="text/javascript"
src="../scripts/timer.js"></script>
The "language" attribute has been deprecated, and you should remove it.
>
but i want to do the following, as the script needs to be used in many
pages at varios folder depths ( it is placed in my master page).

<script language="javascript" type="text/javascript"
src="~/scripts/timer.js"></script>
<script type="text/javascript"
src="/scripts/timer.js"></script>

This looks for the "scripts" folder at the root of the website.

HTH,
Laurent
>
doesnt ASP.NET 2.0 pick up that i've put the "~/" symbol in the script
SRC parameter, as it only works on the pages within the SRC root "../"
which im currently using.

any help appreciated.

thanks,
Paul.
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch


Jan 31 '07 #5
"Milosz Skalecki [MCAD]" <mi*****@REMOVEITwp.plwrote in message
news:56**********************************@microsof t.com...
<script language="javascript"
That's deprecated syntax - you shouldn't be advising people to use it...

<script type="text/javascript"
Jan 31 '07 #6
OK OK Mark, i focused on src attribute :D
--
Milosz
"Mark Rae" wrote:
"Milosz Skalecki [MCAD]" <mi*****@REMOVEITwp.plwrote in message
news:56**********************************@microsof t.com...
<script language="javascript"

That's deprecated syntax - you shouldn't be advising people to use it...

<script type="text/javascript"
Jan 31 '07 #7
Never mind what Mark said. I liked it!
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Milosz Skalecki [MCAD]" wrote:
OK OK Mark, i focused on src attribute :D
--
Milosz
"Mark Rae" wrote:
"Milosz Skalecki [MCAD]" <mi*****@REMOVEITwp.plwrote in message
news:56**********************************@microsof t.com...
<script language="javascript"
That's deprecated syntax - you shouldn't be advising people to use it...

<script type="text/javascript"

Feb 1 '07 #8
Thanks Milosz,

thats just the kind of solution i was looking for, and it works great!
Thanks to all the resfponses rom the others also :-)

regards,
Paul
"Milosz Skalecki [MCAD]" <mi*****@REMOVEITwp.plwrote in message
news:56**********************************@microsof t.com...
Hi there,

Try this one:

<script language="javascript"
src="<%=ResolveClientUrl("~/scripts/timer.js")
%"></script>

or in master page load event

Page.ClientScript.RegisterClientScriptInclude("tim erScript",
ResolveClientUrl("~/scripts/timer.js"));
--
Milosz
"Milsnips" wrote:
>hi Laurent,

it isnt solving my problem, this is the folder heirarchy i have, and
where
my javascript works and doesnt
ROOT
SCRIPTS/
timer.js
TEMPLATES/
main.master - with following line: <script
type="text/javascript" src="../scripts/timer.js"></script>
EN/
projects.aspx - javascript works on this file.
PROJECTS/
active.aspx - javascript DOESNT work here..
completed.aspx - javascript also DOESNT work
here..
I hope you understand the folder heirarchy i;ve done, the BOLD items are
folders

regards,
Paul

"Laurent Bugnion [MVP]" <ga*********@bluewin.chwrote in message
news:Oh**************@TK2MSFTNGP02.phx.gbl...
Hi,

Milsnips wrote:
hi there,

i'm currently using the following line:

<script language="javascript" type="text/javascript"
src="../scripts/timer.js"></script>

The "language" attribute has been deprecated, and you should remove it.
but i want to do the following, as the script needs to be used in many
pages at varios folder depths ( it is placed in my master page).

<script language="javascript" type="text/javascript"
src="~/scripts/timer.js"></script>

<script type="text/javascript"
src="/scripts/timer.js"></script>

This looks for the "scripts" folder at the root of the website.

HTH,
Laurent
doesnt ASP.NET 2.0 pick up that i've put the "~/" symbol in the script
SRC parameter, as it only works on the pages within the SRC root "../"
which im currently using.

any help appreciated.

thanks,
Paul.
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch



Feb 2 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: hokiegal99 | last post by:
I installed Python-2.3 into c:\Program Files\Python23 on a new W2K SP4 computer. When I write a Python script and run it from the command prompt, I get the following error: C:\>python...
1
by: Sergio | last post by:
I'm writing a cgi script that uses graphviz (the dot program) to generate a graph and I'm banging my head against the wall trying to get it to work properly. Currently, if I run the script directly...
121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
3
by: mehul | last post by:
Hi, I am trying to use Active Reports v1.1 (Build 1.1.0.84) in a ASP.NET application. Is it possible to use it through the COM interlop as Crystal Reports for .NET which comes built in with...
1
by: Viktor Popov | last post by:
Hi, I'm trying to upload a file and I do that with this code, but there is a thing which doesn't work. I can't understand how to check if it isn't written the path to the file(the text field of...
6
by: Julien | last post by:
Hello, I have some files located in a file server and managed by a SQL database from a web based interface using ASP + VBSCRIPT technology. I need to automatically copy those files to a web...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
0
by: Ofelia | last post by:
Hi, I'm new to this forum and to Perl language but I would like to ask for your help. I'm working in Linux and the files I need to process are in the format “file.gz”. I created a script which...
2
hsriat
by: hsriat | last post by:
For a good programmer, providing good comments in the code is a must. In PHP, giving comments has no demerits. But what about JavaScript? Do you really want those comments to stay in the code and...
13
by: lawpoop | last post by:
Hello all - I have a two part question. First of all, I have a website under /home/user/www/. The index.php and all the other website pages are under /home/user/www/. For functions that are...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.