473,386 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to tailor the path of an external js file?


Hi all!

here'm my problem.

In a parametric code i have to select which js file to load
but, even if the path string composition is right, the js file is not
executed.
See below:

<head>
.......
<script type="text/javascript">
var gal_num=parent.scelta;
var
gal_par_path=gal_path[gal_num]+"gallery"+gal_num+"/g"+gal_num+"_par.js";

</script>
<script type="text/javascript" src=gal_par_path></script>
</head>

I have tested the gal_par_path in the body, it looks right!
On the contrary, the file is executed if, instead of the local variable
i write it entirely.

Thanks all for any help.
Jul 23 '05 #1
3 1438
On Wed, 28 Jul 2004 12:36:07 +0200, cirillo curiosone
<ci***************@blabla.com> wrote:

Hi all!

here'm my problem.

In a parametric code i have to select which js file to load
but, even if the path string composition is right, the js file is not
executed.
See below:

<head>
.......
<script type="text/javascript">
var gal_num=parent.scelta;
var
gal_par_path=gal_path[gal_num]+"gallery"+gal_num+"/g"+gal_num+"_par.js";

</script>
<script type="text/javascript" src=gal_par_path></script>
The above line is HTML not javascript... try putting:

document.write('<script type="text/javascript" src=' + gal_par_path +
'></script>')

between the first <script> & </script> tags.

Not sure if this will work as I've never done anything like that.

HTH.

Al.

</head>

I have tested the gal_par_path in the body, it looks right!
On the contrary, the file is executed if, instead of the local variable
i write it entirely.

Thanks all for any help.


Jul 23 '05 #2
Harag wrote:
On Wed, 28 Jul 2004 12:36:07 +0200, cirillo curiosone
<ci***************@blabla.com> wrote:

Hi all!

here'm my problem.

In a parametric code i have to select which js file to load
but, even if the path string composition is right, the js file is not
executed.
See below:

<head>
.......
<script type="text/javascript">
var gal_num=parent.scelta;
var
gal_par_path=gal_path[gal_num]+"gallery"+gal_num+"/g"+gal_num+"_par.js";

</script>
<script type="text/javascript" src=gal_par_path></script>


The above line is HTML not javascript... try putting:

document.write('<script type="text/javascript" src=' + gal_par_path +
'></script>')

between the first <script> & </script> tags.

Not sure if this will work as I've never done anything like that.

HTH.


Thanks Harag,

i tried but it doesn't seem to work.
I think there should be one way, at least, to load different values for one
or more variables for different external files.

Let's see if anyone else can help me...
thanks again.
Jul 23 '05 #3
On Wed, 28 Jul 2004 14:54:44 +0200, cirillo curiosone
<ci***************@blabla.com> wrote:
Harag wrote:
On Wed, 28 Jul 2004 12:36:07 +0200, cirillo curiosone
<ci***************@blabla.com> wrote:
>
>Hi all!
>
>here'm my problem.
>
>In a parametric code i have to select which js file to load
>but, even if the path string composition is right, the js file is not
>executed.
>See below:
>
> <head>
> .......
> <script type="text/javascript">
> var gal_num=parent.scelta;
> var
>gal_par_path=gal_path[gal_num]+"gallery"+gal_num+"/g"+gal_num+"_par.js";
>
> </script>
> <script type="text/javascript" src=gal_par_path></script>


The above line is HTML not javascript... try putting:

document.write('<script type="text/javascript" src=' + gal_par_path +
'></script>')

between the first <script> & </script> tags.

Not sure if this will work as I've never done anything like that.

HTH.


Thanks Harag,

i tried but it doesn't seem to work.
I think there should be one way, at least, to load different values for one
or more variables for different external files.

Let's see if anyone else can help me...
thanks again.


oops forgot....

to save getting the error when you click the 2nd paragraph to run the
function in the 2nd file then change the clicking lines to the
following:

<p><span onClick="if (window.a1) a1();">Click Me for Func.1</span>
<p><span onClick="if (window.a2) a2();">Click Me for Func.2</span>
Jul 23 '05 #4

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...
70
by: Michael Hoffman | last post by:
Many of you are familiar with Jason Orendorff's path module <http://www.jorendorff.com/articles/python/path/>, which is frequently recommended here on c.l.p. I submitted an RFE to add it to the...
2
by: Eric Maino | last post by:
Setup Windows 2003 Server - Patched and up to date IIS 6.0 Front Page Server Extensions Installed Windows SharePoint Services Installed Visual Studio 2003 EA Web Sites Microsoft SharePoint...
2
by: Larry Menard | last post by:
I'm trying to catalog a java UDF, and do it as simply as possible. The UDF is in "c:\temp\myudf.class", and I would prefer to not have to copy the file into "sqllib\function". But I'm unable to...
8
by: ghadley_00 | last post by:
Hi, I have an access database with a table linked to an external text file. Occasionally the location of the database and the text file change (but are always in the same directory). Is there a...
10
by: Daniel Mark | last post by:
Hello all: I have set the PATH for Python as follows: My Computer->Properties->Advanced->Environment Variables->System Variables->Path ....; C:\Program Files\Python24; Then I try to run...
5
by: Martin Carpella | last post by:
Hi! I know, that Path-names should be shorter than MAX_PATH (250), but the Win32-SDK allows specifiying longer names using the "\\?\" prefix. As I have an application that accesses files...
8
by: Chris | last post by:
I am writing an app in c#. It uses an external dll library. The library is always in windows/system32 directory. The problem is that Windows directory can be located on C:, D: or different disk...
11
by: cybervigilante | last post by:
I can't seem to change the include path on my local winmachine no matter what I do. It comes up as includ_path .;C:\php5\pear in phpinfo() but there is no such file. I installed the WAMP package...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.