A
Aziz
Hi,
I'm trying to mix them up for something like this but firefox gives me
profiles.p1 is undefined error...
<html><body>
<script type="text\javascript">
function showVal()
{
alert(profiles["p1"][0].x);
}
function profileRecord(x, y, z)
{
this.x = x;
this.y = y;
this.z = z;
}
var profiles = new Array(3);
profiles["p1"][0] = new profileRecord(10, 20, 30);
profiles["p1"][1] = new profileRecord(10, 20, 30);
profiles["p1"][2] = new profileRecord(10, 20, 30);
</script>
<form>
<input type="button" onclick="showVal()" value="Show" />
</form>
</body></html>
I expect "10" would be displayed but instead I get the error that
profiles.p1 doesn't exist. How can I correct it?
Thanks
I'm trying to mix them up for something like this but firefox gives me
profiles.p1 is undefined error...
<html><body>
<script type="text\javascript">
function showVal()
{
alert(profiles["p1"][0].x);
}
function profileRecord(x, y, z)
{
this.x = x;
this.y = y;
this.z = z;
}
var profiles = new Array(3);
profiles["p1"][0] = new profileRecord(10, 20, 30);
profiles["p1"][1] = new profileRecord(10, 20, 30);
profiles["p1"][2] = new profileRecord(10, 20, 30);
</script>
<form>
<input type="button" onclick="showVal()" value="Show" />
</form>
</body></html>
I expect "10" would be displayed but instead I get the error that
profiles.p1 doesn't exist. How can I correct it?
Thanks