Byron wrote:
> In article <C1EF509B-5281-4BC7-AF4F->,
> says...
>> Yes you can. Make sure that the variable is declared in the HEAD
>> section (in script tags of course), that way it acts like a local
>> variable (global to the file).
While it is preferable to declare all global variables in a single location.
it is not necessary. The only requirement is that they be declared (inside
of a script block) outside of a function.
<head></head>
<body>
<script>
var globvar = 25
.....
globvar can be accessed by other scripts in this page.
>>
>> You can then reference that variable elsewhere.
>>
>
> Is this considered "Setting a cookie?" That's what I find tutorials on
> when I google it.
No. That is much different. This is called "setting a variable", i.e.,
setting aside a location in memory to contain a value that can be referenced
later by code running in the same scope. Cookies are written to the client's
disk, and therefore can be referenced by more than one page. Variables are
in memory, and are destroyed when they go out of scope.
Byron, client-side questions (whether vbscript or javascript) should be
posted in one of the .scripting groups, either .scripting.jscript, or
..scripting.vbscript if you want an IE-only solution.
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"