View Single Post
Old 11-14-2005, 03:06 PM   #3
laebedahs
Abecedarian
 
Join Date: Oct 2005
Posts: 172
It's been a while since I've messed with javascript, but I believe you're making it too hard.

Let's start with the function you want to return the value from first.

function function1() {
statements;
// here's the important part: whatever you want to be able to be used in another function or statement, you need to "return" it
return blahblah;
// so if you have a variable named "blahblah" that you stored some info in, it will return that.
}

// here's the second function

function function2(blah) {
document.write(blah);
}

Now... you can pass the first function to the second function like this:

function2(function1());

You can also pass variables/data to the first function like you normally would. You can also return boolean values, such as TRUE or FALSE.
laebedahs is offline   Reply With Quote