jitseschaafsma
06-17-2003, 04:14 AM
I have a js function optellen
<SCRIPT LANGUAGE=javascript>
var totsum=0
function optellen(var1)
{
totsum+=var1
}
</SCRIPT>
as you can see what it does it increase a global variable with var1.
Now my server generates a html page with a number of records. One of the values is stored in [FMP-Field:Cummuren]
Because i want to add up these values of the different records is use the following code in my HTML
<SCRIPT LANGUAGE=javascript> optellen([FMP-Field:Cummuren]) </script>
This works great because at the end of the page :
<SCRIPT LANGUAGE=javascript> document.write(totsum) </script>
Give the correct result.
(* i know there can be other solutions but because of limitations on my server side this is what i have chosen for *)
Now my question is this:
1] I am not sure if this will work for different browser : i mean when generating multiple <script> tags do i not lose my global variable in certain cases.
2] is the <script> functioncall </script> "theoreticall correct"
Thanks for any suggestion
Jitse
<SCRIPT LANGUAGE=javascript>
var totsum=0
function optellen(var1)
{
totsum+=var1
}
</SCRIPT>
as you can see what it does it increase a global variable with var1.
Now my server generates a html page with a number of records. One of the values is stored in [FMP-Field:Cummuren]
Because i want to add up these values of the different records is use the following code in my HTML
<SCRIPT LANGUAGE=javascript> optellen([FMP-Field:Cummuren]) </script>
This works great because at the end of the page :
<SCRIPT LANGUAGE=javascript> document.write(totsum) </script>
Give the correct result.
(* i know there can be other solutions but because of limitations on my server side this is what i have chosen for *)
Now my question is this:
1] I am not sure if this will work for different browser : i mean when generating multiple <script> tags do i not lose my global variable in certain cases.
2] is the <script> functioncall </script> "theoreticall correct"
Thanks for any suggestion
Jitse