Solved

Why do I not have to use "window." every time?

Posted on 2014-07-17
3
115 Views
Last Modified: 2014-08-14
I have a global variable:
aa_pageNameTypeURL

Open in new window

Should I use "window.'" every time I reference this variable? What are the pros/cons?
window.aa_pageNameTypeURL;

Open in new window

0
Comment
Question by:894359
3 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 40203501
<< window. >> make your variable global which mean accessible to everywhere in your page by any javascript code
if you are in a function and use << var aa_pageNameTypeURL = foo >>, aa_pageNameTypeURL is only available in the function.
Google about "javascript scope" to learn more
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBScript on Html 15 47
Asp in script 6 36
Renaming with batch file 4 39
How to check if a check box is active using Java Script? 2 17
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question