SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: global variable

  1. #1
    SitePoint Addict
    Join Date
    Jun 2006
    Posts
    220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    global variable

    I have declared a variable's value as 1.
    i have a button in my page. now every time i click on that button, the variable's value should be incremented by 1. is it possible in js?

  2. #2
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes.
    Code:
    var globalVariable = 1;
    
    // increase by one
    globalVariable++;


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •