0

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".

asked Dec 6, 2013 at 10:51

1 Answer 1

1

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>
answered Dec 6, 2013 at 10:52
Sign up to request clarification or add additional context in comments.

2 Comments

yes agree, need to load variable before loading the script, so comes in scope
Thanks...this works! The other thing I´ve tried now is to call a function in a seperate script-tag after including the file.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.