Posted by: crlx2 Jan 14 2020, 04:58 PM
Sorry for my indecision to express my problem:
this works:
<script src="../clients/code.js"></script>
but this doesn't work:
var FileName="../clients/code.js";
<script src="+FileName+"></script>
I'm not expert to understand the error, but i need to use a variable
thank you
Posted by: Christian J Jan 14 2020, 05:36 PM
QUOTE(crlx2 @ Jan 14 2020, 10:58 PM)
but this doesn't work:
var FileName="../clients/code.js";
<script src="+FileName+"></script>
You can't use javascript code outside a SCRIPT element like that.
QUOTE
I'm not expert to understand the error, but i need to use a variable
What is the variable's value? The URL of the javascript file, or the file's contents, or the file itself? If it's just the URL, you might do something like:
CODE
<script type="text/javascript" id="foo"></script>
<script type="text/javascript">
var url="../clients/code.js";
document.getElementById('foo').src=url;
</script>
(note that you can't both use an URL and embedded javascript code in the same SCRIPT element, hence the need for two SCRIPT elements).
Posted by: crlx2 Jan 14 2020, 06:22 PM
god bless you ! it works, it's just what i was looking for!
thanks a lot Christian