Loading javascript in iframe like gmail loading javascript in hidden iframe(js_frame) and make it context sensitive.
views:
596answers:
1
A:
To access the JavaScript of a parent frame you simply use the parent keyword. For example:
child.htm:
<script>
var childVariable = 'child';
function showParentVariable() {
alert('from child: '+parent.parentVariable);
}
window.onload = function() {
if (!!parent.child && parent.child===window) {
parent.showChildVariable();
}
}
</script>
parent.htm:
<iframe src="child.htm"></iframe>
<script>
var parentVariable = 'parent';
var child = window.frames[0];
function showChildVariable() {
alert('from parent: '+child.childVariable);
}
window.onload = function() {
child.showParentVariable();
}
</script>
Here is a live demo: Child Parent
I don't know what you mean by "context sensitive" though.
brownstone
2009-08-01 17:09:06