PDA

View Full Version : Function problem


andrew1234
11-08-2002, 08:02 AM
Hi

can anyone please tell me why i'm not able to
(I'm new to functions)
see my document.write() on my html page

in the below function.
--------------------------------------------------
<script language =javaScript>


function Ccent(degfahren)
{
var degCent = 5/9 * (degfahren -32);
return degcent;
}

Ccent(55);


document.write( "change to " + degcent);

</script>
---------------------------------------------------------

thanks

andrew

aEr_aEr
11-08-2002, 08:32 AM
because your degcent var does not exist outside of your function Ccent

try this

<script language =javaScript>


function Ccent(degfahren)
{
var degCent = 5/9 * (degfahren -32);
return degcent;
}

returnValue = Ccent(55);


document.write( "change to " + returnValue);

</script>