E
Eric Sessoms
I am trying to create forms on the fly in strict xhtml using
javascript. I won't bore you with why, but I should mention that I'm
only interested in the very latest versions of Mozilla based browsers.
The basic problem is that the forms do not display. I've included a
minimal sample below that illustrates this. It validates, I get no
javascript errors at run time, and most disconcerting of all is that
the DOM tree looks right after the page has loaded... but still
nothing.
Help!
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test Page</title>
<script type="text/javascript">
<![CDATA[
function init() {
var input = document.createElement('input');
document.getElementsByTagName('p').item(0).appendChild(input);
}
]]>
</script>
</head>
<body onload="init();">
<form id="form" action="">
<p><!-- The document displays if I include: <input/> --></p>
</form>
</body>
</html>
javascript. I won't bore you with why, but I should mention that I'm
only interested in the very latest versions of Mozilla based browsers.
The basic problem is that the forms do not display. I've included a
minimal sample below that illustrates this. It validates, I get no
javascript errors at run time, and most disconcerting of all is that
the DOM tree looks right after the page has loaded... but still
nothing.
Help!
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test Page</title>
<script type="text/javascript">
<![CDATA[
function init() {
var input = document.createElement('input');
document.getElementsByTagName('p').item(0).appendChild(input);
}
]]>
</script>
</head>
<body onload="init();">
<form id="form" action="">
<p><!-- The document displays if I include: <input/> --></p>
</form>
</body>
</html>