Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > How to tailor the path of an external js file?

Reply
Thread Tools

How to tailor the path of an external js file?

 
 
cirillo curiosone
Guest
Posts: n/a
 
      07-28-2004

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.


 
Reply With Quote
 
 
 
 
Harag
Guest
Posts: n/a
 
      07-28-2004
On Wed, 28 Jul 2004 12:36:07 +0200, cirillo curiosone
<(E-Mail Removed)> 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.
>


 
Reply With Quote
 
 
 
 
cirillo curiosone
Guest
Posts: n/a
 
      07-28-2004
Harag wrote:

> On Wed, 28 Jul 2004 12:36:07 +0200, cirillo curiosone
> <(E-Mail Removed)> 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.


 
Reply With Quote
 
Harag
Guest
Posts: n/a
 
      07-28-2004
On Wed, 28 Jul 2004 14:54:44 +0200, cirillo curiosone
<(E-Mail Removed)> wrote:

>Harag wrote:
>
>> On Wed, 28 Jul 2004 12:36:07 +0200, cirillo curiosone
>> <(E-Mail Removed)> 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>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to tailor output of help() Kyle Python 2 12-27-2009 02:18 AM
Tinker, Tailor, Soldier, Spy Length Question Nobody DVD Video 3 05-18-2004 05:45 PM
unresolved external symbol/using an external dll Scott Allen C++ 8 05-02-2004 06:11 PM



Advertisments