Results 1 to 4 of 4

Thread: Declare java script variables

  1. #1

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Declare java script variables

    Total Newbie to java script
    Is this the correct way to declare variables ?
    <head>
    <script type='text/javascript'>
    var InPutFeet;//feet entered by user
    var Multipler;// Based on pitch selected from combobox eg; .25, .41 etc
    var FeetToAdd;//feet entered by user x Multipler
    var TotalFeet;//Total square feet with pitch added
    var TotalSquares;// TotalFeet / 100
    </script>
    </head>
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  2. #2
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: Declare java script variables

    Yes, you have properly declared variables there. However, those are all global scope variables, as you don't have them in a 'class' or a function.

  3. #3
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: Declare java script variables

    Also note the character casing, as this is not as friendly as VB. Had to find out the hard way.
    About global variables: There is also a very ugly way to declare them inside a function and still have them as global. You can do that without using the "var" . I wouldn't recommend this approach, unless there is something very specific to do.
    Last edited by sapator; Jun 12th, 2014 at 01:32 AM.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  4. #4

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: Declare java script variables

    Thanks
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

Posting Permissions

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



Click Here to Expand Forum to Full Width