Advanced Search

Results 1 to 3 of 3

Thread: How to pass variable from one function to the other??

  1. #1
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to pass variable from one function to the other??

    Hello all again,
    Can anyone tell me how do I pass one variable from one function to the other?? I tried this:

    Code:
    <script ...>
    function test1(){
    var hello = "Hello World!!!";
    alert('from function one '+hello);
    test2();
    }
    function test2(){
    alert(hello);
    }
    </script>
    but doesn't work.

    do I use this??:

    Code:
    function test1(){
    var hello = "Hello World!!!";
    alert('from function one '+hello);
    test2(hello);
    }
    function test2(hello){
    alert(hello);
    }
    or this:

    Code:
    hello = "Hello World!!!";
    function test1(){
    alert('from function one '+hello);
    test2();
    }
    function test2(){
    alert(hello);
    }

  2. #2
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    I think I answered your question in this thread.

  3. #3
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks blm126, I just read that thread before this.

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
  •