I am using both inbedded script as well as external script in a page. The problem i face is that global variables declared in the inbedded script seem to lose their values as soon as i include the external script using the <script src=something> tag.
Is there any way that i can keep the values in the global variables and use the external scripts?
Any help or suggestions are welcome, thank you.
Thanks for the reply,
Function setKpis is called when the page is loaded and filles the aKpi array. Function getKpis is called from a select (options drop-down list) to populate a second select (options drop-down list).
The Body Tag:
<body ... onload="setKpis()">
The Select Tag:
<select ... onchange="getKpis(this.form)">
The Script Tags:
<script> aKpi declaration and embedded functions </script>
<noscript>Your browser does not support script</noscript>
This works fine if i remove the <script src...> tags, but the minute i put them in the array seems to lose its contents (well, the second select list comes out blank when i select from the first). Maybe i'm doing something wrong? i've also tried to declare the array in the header tag.
After posting the above reply I've found that in fact when I include the <script src="SomeFile">, the page no longer runs the onload event of the <body> tag. This is why I have no values in the aKpi array.
I found that the imported JS overrides the onload event of the <body> tag, so i included a call to the embedded function in the imported JS and now everything works.
Thank you for the help.