user1957700
user1957700

Reputation: 55

Include external JS file and setting variable

I need to include an external JS-file with

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

But I need to set a variable and I tried somthing like this:

<script src="/IframeHelper.js" type="text/javascript">var $Vari = 'Para';</script>

And inside the "IFrameHelper.js" something like this:

var $Site = 'Rootfolder' + $Vari;

But you know...this doesn´t work. But how can I do this? It´s a little bit like calling a script with parameters. But such a parameter can be a JSON-String oder "long text".

Upvotes: 0

Views: 1132

Answers (1)

Satpal
Satpal

Reputation: 133403

As per my understanding you need to include IframeHelper.js file after you declare your variable.

<script type="text/javascript">var $Vari = 'Para';</script>
<script src="/IframeHelper.js" type="text/javascript"></script>

Upvotes: 1

Related Questions