Folks,
I have a simple script below... I come from a programming background
with PHP,C++,bash unix shell scripting so I have a rough understanding
when it comes to javascript. I have written a few javascripts of my own
but only until now have I realised that this will be the first time that
I have wanted to pass data *to* a function, chew it up, and spit it
back... In my test script below, I would have expected the script to
return def=1 and ghi=2, but it doesn't...
Can someone tell me where I've gone wrong? Thanks, all replies, via the
newsgroup would be much appreciated,
randelld
<script language="JavaS cript" type="text/javascript">
function firstFunction(d ef, ghi)
{
def=1;
ghi=2;
return(def, ghi);
}
// create our variables
var def;
var ghi;
// set def=10 and ghi=20
def=10;
ghi=20;
// the function should now change def=1 and ghi=2
firstFunction(d ef,ghi);
document.write( "def=" + def + " ghi="+ghi);
</script>
Comment