BizTalk Utilities CV ,   Jobs ,   Code library  
 
Home Page
JavaScript
How to use JavaScript?
JavaScript Guidelines
Stock sorter example for IE5
Confused about how to use a data island in IE5??
Software Release tracking application
Employee Phonebook dataisland
Multitab DHTML browser
Trim function in Javascript
Multiple Grid
Re: Trim Function in JavaScript
Re: Trim Function in JavaScript
Trim Function in JavaScript using Regular Expressions.
DHTML ScoreBoard Behavior
Re: JScript Super Class To Handle XML Transformations
Updated: Detect XML Parser version using Javascript
XML Cache using IE 5.0 Behaviour
XML cache on client for the desktop application website
Javascript XML element listing
Sorting Data Islands by clicking on the column header (using behaviors).
Simple JS Menu Tree using XSLT
 
LAMP >>

By :Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :03/24/2008
Times viewed :1146

 

JavaScript Variables

Introduction

Variables are an important part of programming languages. They are basically used to store values or information. The variables can then be used in a string or on an element or wherever you need them. Variables should be declared before you use them, however it is not necessary. A variable name should start either with a letter or with an underscore. Nothing else is allowed to start a variable name. The following are valid variable names: x, X, _x, _X or _x99. Note that JavaScript is case-sensitive – so the variables x and X are two different variables.

Example

<html>

<head>

<script type="text/javascript">

            var _MyString = "This is the value of my string."

            document.write(_MyString)

</script>

</head>

<body></body>

</html>

Output

Scope

Variables can be either defined globally or locally. If you define a variable in a function then it is a local variable. The variable is not accessible out of the function. As soon as the function ends the variable is destroyed. If you define a variable outside of a function, then it is called a global variable. This variable is available and accessible everywhere.

Example

<html>

<head>

<script type="text/javascript">

            var globalVar = "This is a global variable.<br/>"

           

            function X()

            {

                        var globalVar = "Is the value changed ?<br/>"

                        document.write(globalVar)

            }

            X()

            document.write(globalVar)

</script>

</head>

<body></body>

</html>

Output


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

A great opportunity to Digital Vide
here is a greate opportunity as a S
A great opportunity as a Network En
A Greate Opportunituy as a SQL Deve
An immediate job opportunity as a B

View all Jobs (Add yours)
View all CV (Add yours)



Host Department NOLIMIT Web Hosting
UK Web Designers
affordable conference calls
Emporio armani sunglasses
New Jersey pool contractor
answering service
conference call services
swimming pool builder
Teleconference
MSN
sunglasses


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP