[thelist] js Mozilla problems!
Hans Fraser
hfraser at videotron.ca
Mon Mar 3 16:24:00 CST 2003
Hello everybody!
i never thought i would say this but here it goes ... (mozilla s#%#$ks)
ok now that i have vented myself out here is the problem: (this might
be a long e-mail)
i started with this function:
function buildDialogWindow(){
// create new window
var newwindow = window.open("", "favWin","titlebar=no, toolbar=no,
location=no, menubar=no,
scrollbars=yes,resizable=yes,width=332,height=225");
// fill it with the default HTML
newwindow.document.open();
newwindow.document.write('<html>\n');
newwindow.document.write('<head>\n');
newwindow.document.write('<title>-</title>\n');
newwindow.document.write('<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">\n');
newwindow.document.write('<script type="text/javascript"
language="Javascript">\n');
newwindow.document.write('function loadStyles(){\n');
newwindow.document.write('var os = "win";\n');
newwindow.document.write('if(navigator.appVersion.indexOf(\'Macintosh\')
>0) os = "mac";\n');
newwindow.document.write('var url = "../../../common/css/" + os +
"_pop";\n');
newwindow.document.write('var str = (\'<link rel="STYLESHEET"
type="text/css" href=\' + \'"\' + url + \'.css" >\');\n');
newwindow.document.write('document.write(str);');
newwindow.document.write('}\n');
newwindow.document.write('loadStyles();\n');
newwindow.document.write('</script>\n');
newwindow.document.write('</head>\n');
newwindow.document.write('<body class="qu">\n');
newwindow.document.write('</body>\n');
newwindow.document.write('</html>\n');
// close the window document !
newwindow.document.close();
var myBodyContent =
document.getElementById('myContentLayer').innerHTML;
// print it in the page
newwindow.document.body.innerHTML = myBodyContent;
newwindow.document.forms[0].foldId.value = 'some Value';
newwindow.document.forms[0].itemName.value = 'some value';
// reset the target of the form
newwindow.document.forms[0].target = 'mainFrame';
}
and this layer in the body! :
<div id="myContentLayer" style="position:relative; display:none;">
<form name="editFold" target="favFrame" method="get"
action="index.php" onSubmit='window.close()'>
<p class="title">Edit</p>
<input name="foldId" type="hidden" value="folderId">
<p>Name: <input type="text" name="itemName" size="45"
maxlength="190"></p>
<input name="submit" type="image" id="submit"
src="../../../common/img/tools/bul_wte_ok_u.gif>
</form>
</div>
and all of this works perfectly in IE mac or pc! ... but does not work
in mozilla because mozilla cannot manipulate any of the html until
after certain time it has been present in the page ... so to do the
same thing in mozilla i had to split the function in 2 like so!
function buildDialogWindow(){
// create new window
var newwindow = window.open("", "favWin","titlebar=no, toolbar=no,
location=no, menubar=no,
scrollbars=yes,resizable=yes,width=332,height=225");
// fill it with the default HTML
newwindow.document.open();
[ snip ... same code as above ... snip]
newwindow.document.write('<body class="qu">\n');
// addition
newwindow.document.write('<script type="text/javascript"
language="Javascript">\n');
newwindow.document.write('window.opener. fillMeUp(this);\n');
newwindow.document.write('</script>\n');
newwindow.document.write('</body>\n');
newwindow.document.write('</html>\n');
// close the window document !
newwindow.document.close();
}
function fillMeUp(me){
var myBodyContent =
document.getElementById('myContentLayer').innerHTML;
// print it in the page
me.document.body.innerHTML = myBodyContent;
me.document.forms[0].foldId.value = 'some Value';
me.document.forms[0].itemName.value = 'some value';
// reset the target of the form
me.document.forms[0].target = 'mainFrame';
}
now this code still works in ie mac and pc but for mozilla it only
inserts the html in the body and the newly inserted html is
innacessible ... of course! so me.document.forms[0] does not even exist
... but it does display!
do you see my problem ...
i just want to create a window and write to it!
it's not that complicated!
no?!???!!?
hans!
More information about the thelist
mailing list