I am trying to access a value that is returned via the $H.toJSON
method.
However, my alerts keeps saying that it is undefined.
Any pointers gratefully received
==== code ====
var Feedback = Class.create({
initialize: function() {
this.offSet = this.getOffsets();
},
getOffsets: function() {
if (window.innerHeight) {
h = window.innerWidth;
w = window.innerHeight;
} else if (document.documentElement &&
document.documentElement.clientHeight) {
h = document.documentElement.clientWidth;
w = document.documentElement.clientHeight;
} else if (document.body) {
h = document.body.clientWidth;
w = document.body.clientHeight;
}
return $H({x: w, y: h}).toJSON();
}
})
==== end code ====
=== mark-up snippet ===
<script type="text/javascript">
var fb = new Feedback;
</script>
<body onload="alert(fb.offSet.x)">
=== mark-up end ===
if I alert(fb.offSet) I receive {"x":878,"y":1563}
I have tried multiple variations:
fb.offSet[0].x
fb.offSet[x]
fb.offSet[0]["x"]
fb.offSet.x[0]
fb.offSet[0].x[0]
Some just error out some returned undefined.
How do I reference these returned hash values?
TIA
Techno~
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---