Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sharing variables between functions.

Status
Not open for further replies.

JohnSwe

Programmer
Feb 20, 2001
14
SE
I have a variable containing todays date. I want this variable to be global an accessible from all functions without having to send it to the functions all the time.

How do I do that?!
 
If you define it like this:

<script>
var todayDate = new Date();
. . .

so you don't define it inside the body of any function, it is already a global variable, and it is accessible from every point of script.

Andrew | starway@mail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top