Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old April 10th, 2005, 11:39 AM
vikaspa vikaspa is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 99 vikaspa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 4 m 45 sec
Reputation Power: 2
how do I use variable defined globally in function

var InclusionCount = 1;
var ExclusionCount = 1;
var PreqCount = 1;

I have avbove variables defined globally (in the begining of a javascript just the way they are displayed here )

I am assigning some javleu say 5 to InclusionCount in fucnction five()
( checkked with aler the new value is now 5)

and want to use this value i.e the new value in another fucntion.
When I give alert fucntion the value becomes 1 (one)

How do I solve this problem

Please please help

Reply With Quote
  #2  
Old April 10th, 2005, 04:14 PM
zombie zombie is offline
Codewalkers Intermediate (1500 - 1999 posts)
 
Join Date: Apr 2007
Location: serbia
Posts: 1,876 zombie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: how do I use variable defined globally in function

this should work..

Code:
var blah = 1;

function one() {
    blah = 3;
}

funciton two() {
    alert(blah);
}

one();
two();


the trick is NOT to declare your global vars in your functions with var blah;

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > how do I use variable defined globally in function


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway