Hello forum,
I have 2 functions that should share data on each other. But i have not succeedede to do that. Here is what i tried so far:
Function abc
{
number = 2;
}
Function xyz
{
var object = new abc;
alert(object.number);
}
I do not how to acquire the value of 'number' from function abc and represent it in the alert box in function xyz. :confused:
Please help me
vwphillips
10-13-2008, 11:48 AM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/
function abc()
{
this.number = 2;
}
function xyz()
{
var object = new abc;
alert(object.number);
}
/*]]>*/
</script></head>
<body onload="xyz();">
</body>
</html>
hey, thanks. but this is not really working and not really the situation i'm in.
I am working in javascript.js no html file.
what basicly is going on is this:
function GenereerRapport(alleen_antwoorden)
{
//...code cut out for easier overview
var this.cijfer_aantal_goed_eerste = Math.round((totaal_aantal_goed_eerste / totaal_aantal_beantwoorde_vragen) * 100);
//...code cut out for easier overview
}
function verzend_vraag()
{
var object = new GenereerRapport();
alert(object.cijfer_aantal_goed_eerste); //if this works O.K.i am going to remove comment on the line below
//top.frames.content.frames.tunnel.document.tunnel.goed.value = object.cijfer_aantal_goed_eerste;
}
so this is what I did so far. but no success
rnd me
10-13-2008, 01:16 PM
you cannot use a dot directly after var.
thus "var this.cijfer_aantal_goed_eerste" is invalid.