Hi,
I'm having problem accessing javascript-created elements from opened
window. This occurs only when I'm including another files in opened
window, javascript or css. When I comment out "<link>" and "<script>"
(point (0)), the script works fine.
The opening window itself (point (1)) can access the object. When page
has been loaded, then I can access the object also (point (3)). The
script does find included files (debug_test2.css and debug_test2.js), I
checked that.
Problem appears only on Firefox (my version is 1.5.0.6, on WinXP). On
IE (6.0) works also fine.
Anybody knows cure?
-------code start--------
<script type="text/javascript">
var win = window.open('about:blank', '_blank', '');
with (win.document) {
// (0) remove comments from next 2 rows,
//writeln('<link rel="stylesheet" href="debug_test2.css"
type="text/css" />');
//writeln('<scr'+'ipt type="text/javascript"
src="debug_test2.js"></scr'+'ipt>');
writeln('<table id="test"></table>');
writeln('<scr'+'ipt type="text/javascript">');
// (1) opened window itself has no problem accessing created table
writeln('document.writeln(document.getElementById( \'test\'));');
writeln('</scr'+'ipt>');
}
// (2) outputs NULL when 2 comments above (0) removed, otherwise has no
problems
document.writeln(win.document.getElementById('test ') + '<br>');
//-->
</script>
<!-- (3) after page has loaded, I can access the object -->
<input type="submit"
onclick="alert(win.document.getElementById('test') ); return false;">
-------code end--------