SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Sep 2000
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting a value from an earlier function

    My problem:

    I have two <scripts> in my file...
    One above in the <head> that has all my functions etc...

    I have a value in there called "myVal" that is created within a function.

    ok...now I have another <script> during the <body> of my page. I want to use that "myVal" value and write that into the page...
    Can I pass this value into this script?
    How?

    --
    tried just the simple document.write(myVal) but it's giving me an error that there is not value for myVal.

  2. #2
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey meztec,

    Why not create myVal as a global variable in the first place?

    aDog

  3. #3
    SitePoint Addict
    Join Date
    Sep 2000
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    exactly what i've done...

    I think my post was a little premature...

  4. #4
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So it works then?

    aDog


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
  •