kosmodisk a écrit :
> 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.
http://stephane.moriaux.perso.orange...i_clone_popup/
> 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?
something wrong in :
document.write(document.getElementById(\'test\'));
perhaps ?
> <script type="text/javascript">
>
> var win = window.open('about:blank', '_blank', '');
var win = window.open(); // will give same result
<script type="text/javascript">
var txt = '<link rel="stylesheet" href="debug_test2.css" '+
'type="text/css" />\n<script type="text/javascript" '+
'src="debug_test2.js"><\/script>\n'+
'<table id="test"><tr><td>a test<\/td><\/tr><\/table>\n'+
'<script type="text/javascript">\n'+
'document.write("\'"+document.getElementById(\'tes t\')+"\'");'+
'\n<\/script>';
// 1st test :
var win1 = window.open();
win1.document.writeln(txt);
// 2nd test :
var win2 = window.open();
win2.document.open();
win2.document.write('<html><body>\n'+txt+'\n<\/body><\/html>');
win2.document.close();
</script>
<form>
<input type="button" value="see 2"
onclick="alert(win2.document.getElementById('test' ));win2.focus();">
<input type="button" value="see 1"
onclick="alert(win1.document.getElementById('test' ));win1.focus();
return false;">
</form>
> <!-- (3) after page has loaded, I can access the object -->
> <input type="submit"
<input type="button"
--
Stephane Moriaux et son [moins] vieux Mac