[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
HowToJavaScriptGlobalVars
If you would load a site containing this script - the script would pop up a message to you, that shows "hello world!"
JavaScript FAQ
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
HowToJavaScriptGlobalVars
Using global vars in JavaScript
You can use Variables that area usable in every subfunction of a JavaScript area by using the "var" operator.
example:
<script language="JavaScript">
var PopupText="Hello World!";
function PopMeUp()
{
alert ( PopupText );
}
PopMeUp();
</script>
If you would load a site containing this script - the script would pop up a message to you, that shows "hello world!"
JavaScript FAQ
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
