Javascript parentNode and innerHTML do not work properly in FireFox
Posted
by
Uda
on Stack Overflow
See other posts from Stack Overflow
or by Uda
Published on 2011-03-08T07:56:38Z
Indexed on
2011/03/08
8:10 UTC
Read the original article
Hit count: 319
Hello, I have a problem when using javascript in Firefox, here is the html:
<HTML>
<BODY>
<TABLE align="center">
<TR><td><input type=button name=submit onclick="javascript:submitIt()" value="submit" align="center"></td></TR>
<TD>
<TABLE>
<DIV STYLE="display:none position:relative;">
<FORM ID="formA" NAME="formA" METHOD="post" ACTION="b.html" TARGET="_blank">
<INPUT TYPE="hidden" NAME=aInput VALUE="1294457296">
</FORM>
</DIV>
</TABLE>
</TD>
</TABLE></BODY></HTML>
and here's the javascript:
<script language="Javascript">
function submitIt()
{
oForm = document.getElementById("formA");
strRequest = "<HTML><BODY>" + oForm.parentNode.innerHTML + "</BODY></HTML>";
newDoc = window.open("", "", "");
newDoc.document.write(strRequest);
}
Problem is when you click submit button in this html page, you'll get a new html with source:
<HTML><BODY><form id="formA" name="formA" method="post" action="b.html" target="_blank"></form>
<input name="aInput" value="1294457296" type="hidden"> </BODY></HTML>
but it's supposed to be
<HTML><BODY><form id="formA" name="formA" method="post" action="b.html" target="_blank">
<input name="aInput" value="1294457296" type="hidden"></form> </BODY></HTML>
Could anyone please help please? it will be really appreciated. Thanks!
© Stack Overflow or respective owner