Calling a Function

I would like to call a function within a function. Is this even possible??
When I do this I get “undefined”

Here’s my code:

<html>
<head>
<script type="text/javascript">
function product(a,b){
   total = a*b;
   display(total);
}

function display(num){
   return num;
}
</script>
</head>

<body>
<h1>This text I do NOT want to be erased.</h1>

<a href="http://google.com" target="_blank">Total: </a>
<script type="text/javascript">
product(3,4);
document.write(display());
</script>

</body>
</html>

I know you can just return in the first function, “product()” but I would like to do something else in my second function “display()” then return a value.

thanks

Multi-posted. People don’t appreciate cross posting of questions in multiple forums, particularly Mickey Mouse queries like this one.

document.write(display());

you are calling display() without passing a parameter to it as expected by your function declaration

function display([COLOR=#ff0000][B]num[/B][/COLOR]) {

The fix should be obvious :slight_smile: