B
believein
Hi all,
I'm playing with javascript DOM and I enjoyed but now I stopped
on a problem I can't solve.
I need to set the 'onclick' on a <div> tag in the opener window from
code in the opened window.
The following code works (without the 'window.opener' prefix) if
executed in the inner of the window. If I use it from the opened window
the tag is created but the 'onclick' not.
var para=window.opener.document.getElementById('images');
var div = window.opener.document.createElement('div');
div.id = "theid";
with (div.style) {
cursor='pointer';
}
div.onclick = function() {
thefunction();
}
div.innerHTML="The text";
para.appendChild(div);
If used in the same window it returns
<div style="cursor: pointer" id="theid" onclick="thefunction();">The
text</div>
while if used in the opened window to create the tag in the opener
window it returns:
<div style="cursor: pointer" id="theid">The text</div>
Any idea?
Thank you
I'm playing with javascript DOM and I enjoyed but now I stopped
on a problem I can't solve.
I need to set the 'onclick' on a <div> tag in the opener window from
code in the opened window.
The following code works (without the 'window.opener' prefix) if
executed in the inner of the window. If I use it from the opened window
the tag is created but the 'onclick' not.
var para=window.opener.document.getElementById('images');
var div = window.opener.document.createElement('div');
div.id = "theid";
with (div.style) {
cursor='pointer';
}
div.onclick = function() {
thefunction();
}
div.innerHTML="The text";
para.appendChild(div);
If used in the same window it returns
<div style="cursor: pointer" id="theid" onclick="thefunction();">The
text</div>
while if used in the opened window to create the tag in the opener
window it returns:
<div style="cursor: pointer" id="theid">The text</div>
Any idea?
Thank you