<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: IE has a problem with getElementsByName</title>
	<atom:link href="http://www.phpied.com/ie-has-a-problem-with-getelementsbyname/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpied.com/ie-has-a-problem-with-getelementsbyname/</link>
	<description>Stoyan&#039;s blog about &#60;a href=&#34;/category/xhtml&#34; class=&#34;tag-minor&#34;&#62;(x)html(5)&#60;/a&#62;, &#60;a href=&#34;/category/ajax&#34; class=&#34;tag-major&#34;&#62;ajax&#60;/a&#62;, &#60;a href=&#34;/category/bookmarklets&#34; class=&#34;tag-major&#34;&#62;bookmarklets&#60;/a&#62;, &#60;a href=&#34;/category/browsers&#34; class=&#34;tag-minor&#34;&#62;browsers&#60;/a&#62;, &#60;a href=&#34;/category/css&#34; class=&#34;tag-normal&#34;&#62;css&#60;/a&#62;, &#60;a href=&#34;/category/firebug&#34; class=&#34;tag-minor&#34;&#62;firebug&#60;/a&#62;, &#60;a href=&#34;/category/javascript&#34; class=&#34;tag-numero-uno&#34;&#62;javascript&#60;/a&#62;, &#60;a href=&#34;/category/json&#34; class=&#34;tag-normal&#34;&#62;json&#60;/a&#62;, &#60;a href=&#34;/category/mdb2&#34; class=&#34;tag-minor&#34;&#62;mdb2&#60;/a&#62;, &#60;a href=&#34;/category/mysql&#34; class=&#34;tag-normal&#34;&#62;mysql&#60;/a&#62;, &#60;a href=&#34;/category/pear&#34; class=&#34;tag-numero-uno&#34;&#62;pear&#60;/a&#62;, &#60;a href=&#34;/category/performance&#34; class=&#34;tag-major&#34;&#62;performance&#60;/a&#62;, &#60;a href=&#34;/category/php&#34; class=&#34;tag-numero-uno&#34;&#62;php&#60;/a&#62;, &#60;a href=&#34;/category/phpbb&#34; class=&#34;tag-major&#34;&#62;phpbb&#60;/a&#62;, &#60;a href=&#34;/category/tools&#34; class=&#34;tag-normal&#34;&#62;tools&#60;/a&#62;, &#60;a href=&#34;/category/yslow&#34; class=&#34;tag-minor&#34;&#62;yslow&#60;/a&#62;, &#60;a href=&#34;/category/yui&#34; class=&#34;tag-normal&#34;&#62;yui&#60;/a&#62;, &#60;a href=&#34;/category/writing&#34; class=&#34;tag-minor&#34;&#62;writing&#60;/a&#62;, &#60;a href=&#34;/category/music&#34; class=&#34;tag-major&#34;&#62;music&#60;/a&#62;,... &#60;a href=&#34;/category/life-and-everything&#34; class=&#34;tag-normal&#34;&#62;life and everything&#60;/a&#62;.</description>
	<lastBuildDate>Sat, 11 Feb 2012 14:07:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	<item>
		<title>By: tester</title>
		<link>http://www.phpied.com/ie-has-a-problem-with-getelementsbyname/#comment-71341</link>
		<dc:creator>tester</dc:creator>
		<pubDate>Mon, 24 Aug 2009 07:35:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpied.com/ie-has-a-problem-with-getelementsbyname/#comment-71341</guid>
		<description>this bug is fixed in version:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.13) Gecko/2009073022 Firefox/3.0.13 (.NET CLR 3.5.30729)</description>
		<content:encoded><![CDATA[<p>this bug is fixed in version:<br />
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.13) Gecko/2009073022 Firefox/3.0.13 (.NET CLR 3.5.30729)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: KAmiloKlauss</title>
		<link>http://www.phpied.com/ie-has-a-problem-with-getelementsbyname/#comment-71100</link>
		<dc:creator>KAmiloKlauss</dc:creator>
		<pubDate>Thu, 09 Jul 2009 09:39:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpied.com/ie-has-a-problem-with-getelementsbyname/#comment-71100</guid>
		<description>Stoyan i have issues with the &quot;onclick&quot; event you need to do some other ugly thing:

input1=document.createElement(&quot;input&quot;);
input1.setAttribute(&quot;type&quot;, &quot;checkbox&quot;);
input1.setAttribute(&quot;onclick&quot;, &quot;optionListInterest()&quot;);
div.appendChild(input1);
input1.parentNode.innerHTML=input1.parentNode.innerHTML;


Ugly, but worked for me.</description>
		<content:encoded><![CDATA[<p>Stoyan i have issues with the &#8220;onclick&#8221; event you need to do some other ugly thing:</p>
<p>input1=document.createElement(&#8220;input&#8221;);<br />
input1.setAttribute(&#8220;type&#8221;, &#8220;checkbox&#8221;);<br />
input1.setAttribute(&#8220;onclick&#8221;, &#8220;optionListInterest()&#8221;);<br />
div.appendChild(input1);<br />
input1.parentNode.innerHTML=input1.parentNode.innerHTML;</p>
<p>Ugly, but worked for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: szako</title>
		<link>http://www.phpied.com/ie-has-a-problem-with-getelementsbyname/#comment-64186</link>
		<dc:creator>szako</dc:creator>
		<pubDate>Sat, 12 Apr 2008 14:17:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpied.com/ie-has-a-problem-with-getelementsbyname/#comment-64186</guid>
		<description>Thanks for the post, I have just discovered the same under ie7, now trying to find some workaround ...</description>
		<content:encoded><![CDATA[<p>Thanks for the post, I have just discovered the same under ie7, now trying to find some workaround &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stoyan</title>
		<link>http://www.phpied.com/ie-has-a-problem-with-getelementsbyname/#comment-62782</link>
		<dc:creator>Stoyan</dc:creator>
		<pubDate>Tue, 16 Oct 2007 06:22:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpied.com/ie-has-a-problem-with-getelementsbyname/#comment-62782</guid>
		<description>Hey Fred, just tried Opera and Safari, they worked as expected (like Firefox).

When you hit the demo page I did and then click &quot;add&quot; and then &quot;count&quot;, both Safari and Opera show the correct number of elements.

Seems to be IE-only bug</description>
		<content:encoded><![CDATA[<p>Hey Fred, just tried Opera and Safari, they worked as expected (like Firefox).</p>
<p>When you hit the demo page I did and then click &#8220;add&#8221; and then &#8220;count&#8221;, both Safari and Opera show the correct number of elements.</p>
<p>Seems to be IE-only bug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fred</title>
		<link>http://www.phpied.com/ie-has-a-problem-with-getelementsbyname/#comment-62780</link>
		<dc:creator>Fred</dc:creator>
		<pubDate>Mon, 15 Oct 2007 22:04:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpied.com/ie-has-a-problem-with-getelementsbyname/#comment-62780</guid>
		<description>Are you sure this is a IE specific bug ? I have the same behavior with Safari and Opera. In fact the only browser who work the way you describe is FireFox.</description>
		<content:encoded><![CDATA[<p>Are you sure this is a IE specific bug ? I have the same behavior with Safari and Opera. In fact the only browser who work the way you describe is FireFox.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stoyan</title>
		<link>http://www.phpied.com/ie-has-a-problem-with-getelementsbyname/#comment-62736</link>
		<dc:creator>Stoyan</dc:creator>
		<pubDate>Fri, 12 Oct 2007 21:14:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpied.com/ie-has-a-problem-with-getelementsbyname/#comment-62736</guid>
		<description>Thanks Steve, I didn&#039;t know this use of createElement was even possible! Looks so wrong.

BTW, I also noticed that in IE when you clone an element that has onclick attribute for example, the new element doesn&#039;t raise the onclick event! Not that anyone should use onclick attributes instead of attaching events, but still...</description>
		<content:encoded><![CDATA[<p>Thanks Steve, I didn&#8217;t know this use of createElement was even possible! Looks so wrong.</p>
<p>BTW, I also noticed that in IE when you clone an element that has onclick attribute for example, the new element doesn&#8217;t raise the onclick event! Not that anyone should use onclick attributes instead of attaching events, but still&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.phpied.com/ie-has-a-problem-with-getelementsbyname/#comment-62660</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Thu, 04 Oct 2007 15:31:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpied.com/ie-has-a-problem-with-getelementsbyname/#comment-62660</guid>
		<description>Doh!... got to escape those brackets ;-) it should be:

var new_input = document.createElement(&#039;&lt;input name=&quot;something[]&quot;/&gt;&#039;);</description>
		<content:encoded><![CDATA[<p>Doh!&#8230; got to escape those brackets <img src='http://www.phpied.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  it should be:</p>
<p>var new_input = document.createElement(&#8216;&lt;input name=&#8221;something[]&#8220;/&gt;&#8217;);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.phpied.com/ie-has-a-problem-with-getelementsbyname/#comment-62659</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Thu, 04 Oct 2007 15:29:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpied.com/ie-has-a-problem-with-getelementsbyname/#comment-62659</guid>
		<description>You&#039;ve (re)discovered the wonderful buggyness of IE.

Documented here: http://webbugtrack.blogspot.com/2007/08/bug-242-setattribute-doesnt-always-work.html

In IE6/IE7 you *CANNOT* set the name attribute of a freshly created DOM element. (you&#039;ll find issues with the type attribute too, but not quite the same)

You need to do the following... and yes, it is *VERY* ugly!

var new_input = document.createElement(&#039;&#039;);

Of course, this will also blow up in any real browser that supports the DOM, so you&#039;ll need to do some browser sniffing or something to apply this...

PS on the type thing... you can set it, but as soon as you append it to the DOM, its fixed... you can&#039;t change it to a radio, checkbox, password, file,.. etc.</description>
		<content:encoded><![CDATA[<p>You&#8217;ve (re)discovered the wonderful buggyness of IE.</p>
<p>Documented here: <a href="http://webbugtrack.blogspot.com/2007/08/bug-242-setattribute-doesnt-always-work.html" rel="nofollow">http://webbugtrack.blogspot.com/2007/08/bug-242-setattribute-doesnt-always-work.html</a></p>
<p>In IE6/IE7 you *CANNOT* set the name attribute of a freshly created DOM element. (you&#8217;ll find issues with the type attribute too, but not quite the same)</p>
<p>You need to do the following&#8230; and yes, it is *VERY* ugly!</p>
<p>var new_input = document.createElement(&#8221;);</p>
<p>Of course, this will also blow up in any real browser that supports the DOM, so you&#8217;ll need to do some browser sniffing or something to apply this&#8230;</p>
<p>PS on the type thing&#8230; you can set it, but as soon as you append it to the DOM, its fixed&#8230; you can&#8217;t change it to a radio, checkbox, password, file,.. etc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pablo</title>
		<link>http://www.phpied.com/ie-has-a-problem-with-getelementsbyname/#comment-62657</link>
		<dc:creator>Pablo</dc:creator>
		<pubDate>Thu, 04 Oct 2007 13:11:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpied.com/ie-has-a-problem-with-getelementsbyname/#comment-62657</guid>
		<description>Happened with IE6 (6.0.29002180.xpsp2_qfe.070227-2300) aswell, but if you add the inputs via innerHTML, it works on IE... strange behaviour... any ideas why?</description>
		<content:encoded><![CDATA[<p>Happened with IE6 (6.0.29002180.xpsp2_qfe.070227-2300) aswell, but if you add the inputs via innerHTML, it works on IE&#8230; strange behaviour&#8230; any ideas why?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

