global variables

Results 1 to 2 of 2

Thread: global variables

  1. #1
    Join Date
    Dec 1969

    Default global variables

    does anyone now how i could call a global variable in an .inc file? <BR>i know vbscript "Something = application("something")" <BR>but how would you do this in javascrip? thanks

  2. #2
    Join Date
    Dec 1969

    Default Same way...

    When you #include a file, the *TEXT* of the file thus included is *MERGED* with your main file. Then the full merged text is passed along to ASP and then along to the script engines.<BR><BR>So there is no syntactic difference between the code you put in a #include&#039;d file and the code you would use in the main file.<BR><BR>And as for doing it in JScript (technically, not JavaScript):<BR><BR>&#060;%@ LANGUAGE="JSCRIPT" %&#062;<BR>&#060;!-- #include file="" --&#062;<BR><BR>And then the "" file might contain:<BR><BR>&#060;%<BR>var whatever = Application.Contents("zamboni");<BR>%&#062;<BR><BR >Possibly that will assign an *object* to "whatever" (which is what happens when you assign a recordset member to a JS variable), in which case you might do something such as:<BR><BR>&#060;%<BR>var whatever = "" + Application.Contents("zamboni");<BR>%&#062;<BR> or<BR>&#060;%<BR>var whatever = parseFloat( Application.Contents("zamboni") );<BR>%&#062;<BR><BR>to make sure that the value is picked up as a string or number, as appropriate.<BR><BR>

Posting Permissions

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