in javascript document.appendChild does not work

RESOLVED DUPLICATE of bug 118327

Status

()

Toolkit
Form Manager
--
trivial
RESOLVED DUPLICATE of bug 118327
11 years ago
10 years ago

People

(Reporter: Wim Flory, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: Not a bug just a difference with IE again mozilla is right)

(Reporter)

Description

11 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9

The next source works under IE but not under Mozilla:
var requestForm;
function RequestPage(page) {
alert("menu clicked");
if(requestForm == null) {
requestForm = document.createElement('FORM');
alert("so far so good 1");
requestForm.setAttribute('name','myForm');
alert("so far so good 2");
requestForm.setAttribute('target','mainFrame');
alert("so far so good 3");
requestForm.setAttribute('method','POST');
alert("so far so good 3A")
document.appendChild(requestForm);
alert("so far so good 4");
}
requestForm.setAttribute('action',page);
alert("submit nu")
requestForm.submit();
}
After alert 3A everything stops while using Mozilla
The pages are:
<!--
Document : topFrame
Created on : 17-nov-2007, 12:14:05
Author : wim flory
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="common.js"></script>
</head>
<body>
<table>
<tr>
<td>
<input type="button" name="Addresses" value="Addresses"
onclick="RequestPage('http://hp-wim:8080/jsTestbed/Addresses.jsp')">
</td>
<td>
<input type="button" name="Calendar" value="Calendar"
onclick="RequestPage('Calendar.jsp')">
</td>
</tr>
</table>
</body>
</html>
<%--
Document : Addresses
Created on : 17-nov-2007, 13:22:35
Author : wim flory
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h2>Addresses</h2>
</body>
</html>
What bothers me is that it all works under IE, I do not like IE and want my software to work under
any browser.

Reproducible: Always

Steps to Reproduce:
1.create javascipt to hidden call a form
2.create input button
3.click button
Actual Results:  
The next source works under IE but not under Mozilla:
var requestForm;
function RequestPage(page) {
alert("menu clicked");
if(requestForm == null) {
requestForm = document.createElement('FORM');
alert("so far so good 1");
requestForm.setAttribute('name','myForm');
alert("so far so good 2");
requestForm.setAttribute('target','mainFrame');
alert("so far so good 3");
requestForm.setAttribute('method','POST');
alert("so far so good 3A")
document.appendChild(requestForm);
alert("so far so good 4");
}
requestForm.setAttribute('action',page);
alert("submit nu")
requestForm.submit();
}
After alert 3A everything stops while using Mozilla
The pages are:
<!--
Document : topFrame
Created on : 17-nov-2007, 12:14:05
Author : wim flory
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="common.js"></script>
</head>
<body>
<table>
<tr>
<td>
<input type="button" name="Addresses" value="Addresses"
onclick="RequestPage('http://hp-wim:8080/jsTestbed/Addresses.jsp')">
</td>
<td>
<input type="button" name="Calendar" value="Calendar"
onclick="RequestPage('Calendar.jsp')">
</td>
</tr>
</table>
</body>
</html>
<%--
Document : Addresses
Created on : 17-nov-2007, 13:22:35
Author : wim flory
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h2>Addresses</h2>
</body>
</html>
What bothers me is that it all works under IE, I do not like IE and want my software to work under
any browser.

Expected Results:  
Nothing under Mozilla, but fine under IE (and I hate microsoft and want to convince my cLient Mozilla and open source is better) 

shown the requested page
Appending an element to a document is unlikely to work unless the document already doesnt contain any elements. A document can only have one direct child element. Maybe you mean to use document.body.appendChild or append the element to a more specific place in the document?

Updated

11 years ago
Status: UNCONFIRMED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 118327
(Reporter)

Comment 3

11 years ago
Sorry,

My mistake, I should have known you folks are better than Microsoft, I was only worried about my project.
Severity: normal → trivial
Resolution: DUPLICATE → FIXED
Whiteboard: Not a bug just a difference with IE again mozilla is right
The original code fails because of bug 118327 so this is a dupe
Resolution: FIXED → DUPLICATE
Duplicate of bug: 118327
(Assignee)

Updated

10 years ago
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.