Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

dom created radio buttons don't work in IE?

2 views
Skip to first unread message

Riku Voipio

unread,
Oct 21, 2002, 8:19:57 AM10/21/02
to
I've been experimenting with DOM and javascript, and just as I was
getting
impressed, I noticed that Internet Exploder doesn't seem to work with
newly
created input type buttons. The new radio option is renderred, but it
is unselectable. Apparently IE fails realize that the name propery is
set,
as a similar "unselectable" effect appears if the name attribute is
left from
the static html..

Mozilla works fine, and IE works if I change the type to 'chekbox'.
With non-standard createElement('<input type=... />'); works too, but
doesn't work anywhere else and looks horrible. Is this really a IE bug
or is creating forms this way unsupported by the standard? Using IE
6.0.2800.1106 /sp1 on w2k/sp3

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
<html>
<head>
<link rel="stylesheet" href="default.css" type="text/css"/>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<script type="text/javascript">
function init()
{
var minput=document.createElement('input');
minput.type='radio';
minput.name='combination';
minput.value='dynamic';
document.getElementById('myForm').appendChild(minput);
var text=document.createTextNode('dynamic');
document.getElementById('myForm').appendChild(text);
}
</script>
<title>No javascript support!</title>
</head>
<body class="default" onload='init()'>
<form name="hv" action="blah.jsp" id="myForm">
<input type="radio" name="combination" value="static"/>static
</form>
</body>
</html>

Yep

unread,
Oct 21, 2002, 3:41:18 PM10/21/02
to
nc...@kos.to (Riku Voipio) wrote in message news:<59a7da80.02102...@posting.google.com>...

> I've been experimenting with DOM and javascript, and just as I was
> getting
> impressed, I noticed that Internet Exploder doesn't seem to work with
> newly
> created input type buttons. The new radio option is renderred, but it
> is unselectable. Apparently IE fails realize that the name propery is
> set,
> as a similar "unselectable" effect appears if the name attribute is
> left from
> the static html..
>

<snip />

This is an IE bug, using innerHTML to parse the elements works fine
either in IE and Mozilla. Just createElement a SPAN, innerHTML it with
the radio, then move the radio node up and delete the span node to
clean up the tree.

hth...
Yep.

0 new messages